Fix debug build for X.Yy-dev (#3011)

also just use extglob everywhere
This commit is contained in:
native-api 2024-07-06 04:04:46 +03:00 committed by GitHub
parent 662b5ddd13
commit 50e726ac41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,6 +19,7 @@ PYTHON_BUILD_VERSION="20180424"
OLDIFS="$IFS" OLDIFS="$IFS"
set -E set -E
shopt -s extglob
[ -n "$PYENV_DEBUG" ] && { [ -n "$PYENV_DEBUG" ] && {
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -x set -x
@ -1784,20 +1785,14 @@ build_package_auto_tcltk() {
fi fi
} }
# extglob must be set at both parse time and runtime
# https://stackoverflow.com/questions/49283740/bash-script-throws-syntax-errors-when-the-extglob-option-is-set-inside-a-subsh
shopt -s extglob
package_is_python() { package_is_python() {
shopt -s extglob
case "$1" in case "$1" in
Python-* | jython-* | pypy-* | pypy[0-9].+([0-9])-* | stackless-* ) Python-* | jython-* | pypy-* | pypy[0-9].+([0-9])-* | stackless-* )
return 0 return 0
;; ;;
esac esac
return 1 return 1
shopt -u extglob
} }
shopt -u extglob
apply_patch() { apply_patch() {
local package_name="$1" local package_name="$1"
@ -2308,7 +2303,6 @@ if [[ "$PYPY_OPTS" == *"--shared"* ]]; then
fi fi
# Add support for framework installation (`--enable-framework`) of CPython (#55, #99) # Add support for framework installation (`--enable-framework`) of CPython (#55, #99)
shopt -s extglob
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
if ! is_mac; then if ! is_mac; then
echo "python-build: framework installation is not supported outside of MacOS." >&2 echo "python-build: framework installation is not supported outside of MacOS." >&2
@ -2334,10 +2328,8 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; the
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}"; PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}";
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }" PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }"
fi fi
shopt -u extglob
# Build against universal SDK # Build against universal SDK
shopt -s extglob
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then
if ! is_mac; then if ! is_mac; then
echo "python-build: universal installation is not supported outside of MacOS." >&2 echo "python-build: universal installation is not supported outside of MacOS." >&2
@ -2359,7 +2351,6 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]];
fi fi
fi fi
fi fi
shopt -u extglob
# Compile with `--enable-unicode=ucs4` by default (#257) # Compile with `--enable-unicode=ucs4` by default (#257)
if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then
@ -2454,6 +2445,7 @@ python_bin_suffix() {
version_name="${version_name%-dev}" version_name="${version_name%-dev}"
version_name="${version_name%-rc*}" version_name="${version_name%-rc*}"
version_name="${version_name%rc*}" version_name="${version_name%rc*}"
version_name="${version_name%%*([^0-9])}"
version_info=(${version_name//./ }) version_info=(${version_name//./ })
echo "${version_info[0]}.${version_info[1]}" echo "${version_info[0]}.${version_info[1]}"
;; ;;