Merge pull request #1935 from native-api/framework_prefix

Prevent build from installing MacOS apps globally
This commit is contained in:
Anton Petrov 2021-05-20 22:50:31 +03:00 committed by GitHub
commit aa950f939a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 18 deletions

View file

@ -1554,7 +1554,7 @@ build_package_symlink_version_suffix() {
mv -f "${PREFIX_PATH}/bin" "${PREFIX_PATH}/bin.orig"
fi
# Only symlinks are installed in ${PREFIX_PATH}/bin
ln -fs "${PREFIX_PATH}/Python.framework/Versions/Current/bin" "${PREFIX_PATH}/bin"
ln -fs "${PREFIX_PATH}/Library/Frameworks/Python.framework/Versions/Current/bin" "${PREFIX_PATH}/bin"
fi
# Not create symlinks on `altinstall` (#255)
@ -2016,16 +2016,17 @@ if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
fi
create_framework_dirs() {
local version="$(echo "$1" | sed -E 's/^[^0-9]*([0-9]+\.[0-9]+).*$/\1/')"
mkdir -p "${PREFIX_PATH}/Python.framework/Versions/${version}"
( cd "${PREFIX_PATH}/Python.framework/Versions" && ln -fs "${version}" "Current")
mkdir -p "${PREFIX_PATH}/Library/Frameworks/Python.framework/Versions/${version}"
( cd "${PREFIX_PATH}/Library/Frameworks/Python.framework/Versions" && ln -fs "${version}" "Current")
local path
for path in include lib share; do
mkdir -p "${PREFIX_PATH}/Python.framework/Versions/Current/${path}"
ln -fs "${PREFIX_PATH}/Python.framework/Versions/Current/${path}" "${PREFIX_PATH}/${path}"
mkdir -p "${PREFIX_PATH}/Library/Frameworks/Python.framework/Versions/Current/${path}"
ln -fs "${PREFIX_PATH}/Library/Frameworks/Python.framework/Versions/Current/${path}" "${PREFIX_PATH}/${path}"
done
}
create_framework_dirs "${DEFINITION_PATH##*/}"
package_option python configure --enable-framework="${PREFIX_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"
fi
# Build against universal SDK (#219, #220)

View file

@ -249,15 +249,15 @@ OUT
}
@test "enable framework" {
mkdir -p "${INSTALL_ROOT}/Python.framework/Versions/Current/bin"
touch "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3"
chmod +x "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3"
touch "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3.4"
chmod +x "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3.4"
touch "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3-config"
chmod +x "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3-config"
touch "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3.4-config"
chmod +x "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python3.4-config"
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"
# yyuu/pyenv#257
stub uname '-s : echo Darwin'
@ -270,11 +270,11 @@ verify_python python3.4
OUT
assert_success
assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-framework=${TMP}/install)
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-framework=${TMP}/install/Library/Frameworks)
EOS
[ -L "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python" ]
[ -L "${INSTALL_ROOT}/Python.framework/Versions/Current/bin/python-config" ]
[ -L "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python" ]
[ -L "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python-config" ]
}
@test "enable universalsdk" {