|
|
|
@ -20,6 +20,13 @@ |
|
|
|
# --version Show version of python-build |
|
|
|
# -g/--debug Build a debug version |
|
|
|
# |
|
|
|
# Append `:<alias>' to a version to install it under a custom name, so that |
|
|
|
# several builds of the same version can coexist: |
|
|
|
# |
|
|
|
# pyenv install 3.12.0:my-3.12 |
|
|
|
# |
|
|
|
# This installs into $PYENV_ROOT/versions/my-3.12. |
|
|
|
# |
|
|
|
# For detailed information on installing Python versions with |
|
|
|
# python-build, including a list of environment variables for adjusting |
|
|
|
# compilation, see: https://github.com/pyenv/pyenv#readme |
|
|
|
@ -123,6 +130,20 @@ DEFINITIONS=("${ARGUMENTS[@]}") |
|
|
|
[[ "${#DEFINITIONS[*]}" -eq 0 ]] && DEFINITIONS=($(pyenv-local 2>/dev/null || true)) |
|
|
|
[[ "${#DEFINITIONS[*]}" -eq 0 ]] && usage 1 >&2 |
|
|
|
|
|
|
|
# A `<version>:<alias>` argument installs <version> under the custom name |
|
|
|
# <alias>, so that several builds of the same version can coexist. The `latest` |
|
|
|
# suffix is reserved for latest-version resolution (see the `install` hook), so |
|
|
|
# it is left untouched here. |
|
|
|
declare -a ALIASES |
|
|
|
for i in "${!DEFINITIONS[@]}"; do |
|
|
|
definition="${DEFINITIONS[$i]}" |
|
|
|
alias="${definition##*:}" |
|
|
|
if [[ "$definition" == *:* ]] && [ "$alias" != "latest" ]; then |
|
|
|
DEFINITIONS[$i]="${definition%:*}" |
|
|
|
ALIASES[$i]="$alias" |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
# Define `before_install` and `after_install` functions that allow |
|
|
|
# plugin hooks to register a string of code for execution before or |
|
|
|
# after the installation process. |
|
|
|
@ -152,7 +173,9 @@ IFS="$OLDIFS" |
|
|
|
for script in "${scripts[@]}"; do source "$script"; done |
|
|
|
|
|
|
|
COMBINED_STATUS=0 |
|
|
|
for DEFINITION in "${DEFINITIONS[@]}"; do |
|
|
|
for i in "${!DEFINITIONS[@]}"; do |
|
|
|
DEFINITION="${DEFINITIONS[$i]}" |
|
|
|
VERSION_ALIAS="${ALIASES[$i]}" |
|
|
|
STATUS=0 |
|
|
|
|
|
|
|
# Try to resolve a prefix if user indeed gave a prefix. |
|
|
|
@ -161,9 +184,12 @@ for DEFINITION in "${DEFINITIONS[@]}"; do |
|
|
|
DEFINITION="$(pyenv-latest -f -k "$DEFINITION")" |
|
|
|
|
|
|
|
# Set VERSION_NAME from $DEFINITION. Then compute the installation prefix. |
|
|
|
# With a `<version>:<alias>` argument, install under the alias instead; |
|
|
|
# VERSION_NAME still reflects the real version so version-specific build logic |
|
|
|
# (e.g. the bootstrap version detection below) keeps working. |
|
|
|
VERSION_NAME="${DEFINITION##*/}" |
|
|
|
[ -n "$DEBUG" ] && VERSION_NAME="${VERSION_NAME}-debug" |
|
|
|
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}" |
|
|
|
PREFIX="${PYENV_ROOT}/versions/${VERSION_ALIAS:-$VERSION_NAME}" |
|
|
|
|
|
|
|
[ -d "${PREFIX}" ] && PREFIX_EXISTS=1 |
|
|
|
|
|
|
|
@ -188,7 +214,7 @@ for DEFINITION in "${DEFINITIONS[@]}"; do |
|
|
|
|
|
|
|
# If PYENV_BUILD_ROOT is set, always pass keep options to python-build. |
|
|
|
if [ -n "${PYENV_BUILD_ROOT}" ]; then |
|
|
|
export PYTHON_BUILD_BUILD_PATH="${PYENV_BUILD_ROOT}/${VERSION_NAME}" |
|
|
|
export PYTHON_BUILD_BUILD_PATH="${PYENV_BUILD_ROOT}/${VERSION_ALIAS:-$VERSION_NAME}" |
|
|
|
KEEP="-k" |
|
|
|
fi |
|
|
|
|
|
|
|
|