mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Add an option to build a debug version of Python
This commit is contained in:
parent
aa831836e1
commit
8bf0938e60
2 changed files with 18 additions and 4 deletions
|
@ -2,12 +2,13 @@
|
|||
#
|
||||
# Summary: Install a Python version using the python-build plugin
|
||||
#
|
||||
# Usage: pyenv install [-f|--force] [-k|--keep] [-v|--verbose] <version>
|
||||
# pyenv install [-f|--force] [-k|--keep] [-v|--verbose] <definition-file>
|
||||
# Usage: pyenv install [-f|--force] [-g|--debug] [-k|--keep] [-v|--verbose] <version>
|
||||
# pyenv install [-f|--force] [-g|--debug] [-k|--keep] [-v|--verbose] <definition-file>
|
||||
# pyenv install -l|--list
|
||||
#
|
||||
# -l/--list List all available versions
|
||||
# -f/--force Install even if the version appears to be installed already
|
||||
# -g/--debug Build a debug version
|
||||
# -k/--keep Keep source tree in $PYENV_BUILD_ROOT after installation
|
||||
# (defaults to $PYENV_ROOT/sources)
|
||||
# -v/--verbose Verbose mode: print compilation status to stdout
|
||||
|
@ -40,6 +41,7 @@ usage() {
|
|||
unset FORCE
|
||||
unset KEEP
|
||||
unset VERBOSE
|
||||
unset DEBUG
|
||||
|
||||
parse_options "$@"
|
||||
for option in "${OPTIONS[@]}"; do
|
||||
|
@ -61,6 +63,9 @@ for option in "${OPTIONS[@]}"; do
|
|||
"v" | "verbose" )
|
||||
VERBOSE="-v"
|
||||
;;
|
||||
"g" | "debug" )
|
||||
DEBUG="-g"
|
||||
;;
|
||||
"version" )
|
||||
exec python-build --version
|
||||
;;
|
||||
|
@ -105,6 +110,7 @@ done
|
|||
# Set VERSION_NAME from $DEFINITION, if it is not already set. Then
|
||||
# compute the installation prefix.
|
||||
[ -n "$VERSION_NAME" ] || VERSION_NAME="${DEFINITION##*/}"
|
||||
[ -n "$DEBUG" ] && VERSION_NAME="${VERSION_NAME}-debug"
|
||||
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}"
|
||||
|
||||
# If the installation prefix exists, prompt for confirmation unless
|
||||
|
@ -138,7 +144,7 @@ for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
|||
# Invoke `python-build` and record the exit status in $STATUS. Run
|
||||
# `pyenv rehash` after a successful installation.
|
||||
STATUS=0
|
||||
python-build $KEEP $VERBOSE "$DEFINITION" "$PREFIX" || STATUS="$?"
|
||||
python-build $KEEP $VERBOSE $DEBUG "$DEFINITION" "$PREFIX" || STATUS="$?"
|
||||
|
||||
# Execute `after_install` hooks.
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
|
|
|
@ -557,7 +557,7 @@ version() {
|
|||
|
||||
usage() {
|
||||
{ version
|
||||
echo "usage: python-build [-k|--keep] [-v|--verbose] definition prefix"
|
||||
echo "usage: python-build [-g|--debug] [-k|--keep] [-v|--verbose] definition prefix"
|
||||
echo " python-build --definitions"
|
||||
} >&2
|
||||
|
||||
|
@ -577,6 +577,7 @@ list_definitions() {
|
|||
|
||||
unset VERBOSE
|
||||
unset KEEP_BUILD_PATH
|
||||
unset DEBUG
|
||||
PYTHON_BUILD_ROOT="$(abs_dirname "$0")/.."
|
||||
|
||||
parse_options "$@"
|
||||
|
@ -603,6 +604,9 @@ for option in "${OPTIONS[@]}"; do
|
|||
"v" | "verbose" )
|
||||
VERBOSE=true
|
||||
;;
|
||||
"g" | "debug" )
|
||||
DEBUG=true
|
||||
;;
|
||||
"version" )
|
||||
version
|
||||
exit 0
|
||||
|
@ -661,6 +665,10 @@ else
|
|||
unset PYTHON_BUILD_MIRROR_URL
|
||||
fi
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
CONFIGURE_OPTS="--with-pydebug"
|
||||
fi
|
||||
|
||||
SEED="$(date "+%Y%m%d%H%M%S").$$"
|
||||
LOG_PATH="${TMP}/python-build.${SEED}.log"
|
||||
PYTHON_BIN="${PREFIX_PATH}/bin/python"
|
||||
|
|
Loading…
Reference in a new issue