Skip to content

Commit 49fba59

Browse files
authored
Add an ability to install a specific version of pyenv (#126)
1 parent 771de8e commit 49fba59

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Once prerequisites have been installed correctly:
1919

2020
Install:
2121
~~~~
22+
If you wish to install a specific release of Pyenv rather than the latest head, set the ``PYENV_GIT_TAG`` environment variable (e.g. ``export PYENV_GIT_TAG=v2.2.5``).
23+
2224
.. code:: bash
2325
2426
curl https://pyenv.run | bash

bin/pyenv-installer

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ failed_checkout() {
2929
}
3030

3131
checkout() {
32-
[ -d "$2" ] || git clone --depth 1 "$1" "$2" || failed_checkout "$1"
32+
[ -d "$2" ] || git -c advice.detachedHead=0 clone --branch "$3" --depth 1 "$1" "$2" || failed_checkout "$1"
3333
}
3434

3535
if ! command -v git 1>/dev/null 2>&1; then
@@ -43,12 +43,12 @@ else
4343
GITHUB="https://github.com"
4444
fi
4545

46-
checkout "${GITHUB}/pyenv/pyenv.git" "${PYENV_ROOT}"
47-
checkout "${GITHUB}/pyenv/pyenv-doctor.git" "${PYENV_ROOT}/plugins/pyenv-doctor"
48-
checkout "${GITHUB}/pyenv/pyenv-installer.git" "${PYENV_ROOT}/plugins/pyenv-installer"
49-
checkout "${GITHUB}/pyenv/pyenv-update.git" "${PYENV_ROOT}/plugins/pyenv-update"
50-
checkout "${GITHUB}/pyenv/pyenv-virtualenv.git" "${PYENV_ROOT}/plugins/pyenv-virtualenv"
51-
checkout "${GITHUB}/pyenv/pyenv-which-ext.git" "${PYENV_ROOT}/plugins/pyenv-which-ext"
46+
checkout "${GITHUB}/pyenv/pyenv.git" "${PYENV_ROOT}" "${PYENV_GIT_TAG:-master}"
47+
checkout "${GITHUB}/pyenv/pyenv-doctor.git" "${PYENV_ROOT}/plugins/pyenv-doctor" "master"
48+
checkout "${GITHUB}/pyenv/pyenv-installer.git" "${PYENV_ROOT}/plugins/pyenv-installer" "master"
49+
checkout "${GITHUB}/pyenv/pyenv-update.git" "${PYENV_ROOT}/plugins/pyenv-update" "master"
50+
checkout "${GITHUB}/pyenv/pyenv-virtualenv.git" "${PYENV_ROOT}/plugins/pyenv-virtualenv" "master"
51+
checkout "${GITHUB}/pyenv/pyenv-which-ext.git" "${PYENV_ROOT}/plugins/pyenv-which-ext" "master"
5252

5353
if ! command -v pyenv 1>/dev/null; then
5454
{ echo

0 commit comments

Comments
 (0)