mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
This commit is contained in:
parent
96828af31e
commit
dd60d5fae2
2 changed files with 37 additions and 11 deletions
|
@ -1742,9 +1742,9 @@ apply_patch() {
|
|||
|
||||
|
||||
build_package_symlink_version_suffix() {
|
||||
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
|
||||
if [[ "${PYTHON_CONFIGURE_OPTS_ARRAY[*]} $CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
|
||||
if [ -e "${PREFIX_PATH}/bin" ]; then
|
||||
# Always create `bin` as symlink to framework path if the version was built with `--enable-frameowrk` (#590)
|
||||
# Always create `bin` as symlink to framework path if the version was built with `--enable-framework` (#590)
|
||||
rm -rf "${PREFIX_PATH}/bin.orig"
|
||||
mv -f "${PREFIX_PATH}/bin" "${PREFIX_PATH}/bin.orig"
|
||||
fi
|
||||
|
@ -2219,6 +2219,7 @@ if [[ "$PYPY_OPTS" == *"--shared"* ]]; then
|
|||
fi
|
||||
|
||||
# Add support for framework installation (`--enable-framework`) of CPython (#55, #99)
|
||||
shopt -s extglob
|
||||
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
|
||||
if ! is_mac; then
|
||||
echo "python-build: framework installation is not supported outside of MacOS." >&2
|
||||
|
@ -2237,15 +2238,29 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; the
|
|||
create_framework_dirs "${DEFINITION_PATH##*/}"
|
||||
# the `/Library/Frameworks` suffix makes CPython build install apps under prefix rather than into /Applications (#1003)
|
||||
package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks"
|
||||
|
||||
#FIXME: doesn't properly handle paths with spaces. Fix by parsing *OPTS into arrays.
|
||||
CONFIGURE_OPTS="${CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}";
|
||||
CONFIGURE_OPTS="${CONFIGURE_OPTS% }"
|
||||
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}";
|
||||
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }"
|
||||
fi
|
||||
shopt -u extglob
|
||||
|
||||
# Build against universal SDK
|
||||
shopt -s extglob
|
||||
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then
|
||||
if ! is_mac; then
|
||||
echo "python-build: universal installation is not supported outside of MacOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
package_option python configure --enable-universalsdk=/
|
||||
#FIXME: doesn't properly handle paths with spaces. Fix by parsing *OPTS into arrays.
|
||||
CONFIGURE_OPTS="${CONFIGURE_OPTS//--enable-universalsdk?(=*([^ ]))?( )/}"
|
||||
CONFIGURE_OPTS="${CONFIGURE_OPTS% }"
|
||||
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-universalsdk?(=*([^ ]))?( )/}"
|
||||
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }"
|
||||
|
||||
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" != *"--with-universal-archs"* ]]; then
|
||||
# in CPython's configure.ac, --with-universal-archs defaults to 'intel' which means i386 + x86_64
|
||||
# since 2.7.5 and 3.3.0 -- i.e. in all non-EOL versions
|
||||
|
@ -2255,6 +2270,7 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]];
|
|||
fi
|
||||
fi
|
||||
fi
|
||||
shopt -u extglob
|
||||
|
||||
# Compile with `--enable-unicode=ucs4` by default (#257)
|
||||
if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then
|
||||
|
|
|
@ -245,25 +245,27 @@ OUT
|
|||
}
|
||||
|
||||
@test "enable framework" {
|
||||
mkdir -p "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin"
|
||||
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3"
|
||||
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3"
|
||||
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4"
|
||||
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4"
|
||||
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3-config"
|
||||
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3-config"
|
||||
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config"
|
||||
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config"
|
||||
framework_path="${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin"
|
||||
mkdir -p "$framework_path"
|
||||
for executable in python3{,.4}{,-config}; do
|
||||
touch "$framework_path/$executable"
|
||||
chmod +x "$framework_path/$executable"
|
||||
done
|
||||
unset framework_path executable
|
||||
|
||||
for i in {1..3}; do stub uname '-s : echo Darwin'; done
|
||||
|
||||
PYTHON_CONFIGURE_OPTS="--enable-framework" TMPDIR="$TMP" run_inline_definition <<OUT
|
||||
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
||||
echo "PYTHON_CONFIGURE_OPTS=(\${PYTHON_CONFIGURE_OPTS})"
|
||||
echo "CONFIGURE_OPTS=(\${CONFIGURE_OPTS})"
|
||||
verify_python python3.4
|
||||
OUT
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-framework=${TMP}/install/Library/Frameworks)
|
||||
PYTHON_CONFIGURE_OPTS=()
|
||||
CONFIGURE_OPTS=()
|
||||
EOS
|
||||
|
||||
[ -L "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python" ]
|
||||
|
@ -277,10 +279,14 @@ EOS
|
|||
|
||||
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
|
||||
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
||||
echo "PYTHON_CONFIGURE_OPTS=(\${PYTHON_CONFIGURE_OPTS})"
|
||||
echo "CONFIGURE_OPTS=(\${CONFIGURE_OPTS})"
|
||||
OUT
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-shared --libdir=${TMP}/install/lib --enable-universalsdk=/)
|
||||
PYTHON_CONFIGURE_OPTS=()
|
||||
CONFIGURE_OPTS=()
|
||||
EOS
|
||||
}
|
||||
|
||||
|
@ -291,10 +297,14 @@ EOS
|
|||
|
||||
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
|
||||
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
||||
echo "PYTHON_CONFIGURE_OPTS=(\${PYTHON_CONFIGURE_OPTS})"
|
||||
echo "CONFIGURE_OPTS=(\${CONFIGURE_OPTS})"
|
||||
OUT
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-shared --libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=universal2)
|
||||
PYTHON_CONFIGURE_OPTS=()
|
||||
CONFIGURE_OPTS=()
|
||||
EOS
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue