From b225f2030dbb2ba10aba3f606aff15655334a5c0 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Sat, 18 Jan 2014 01:52:50 +0900 Subject: [PATCH 1/2] Add support for `--enable-framework` (#55, #99) ``` $ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.3.2 ``` --- plugins/python-build/bin/python-build | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 89a7d903..1f3f1ea7 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1062,6 +1062,19 @@ apply_python_patch() { build_package_verify_python() { local package_name="$1" local python="$2" + if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then + local path file + for path in bin include lib share; do + mkdir -p "${PREFIX_PATH}/${path}" + mv -f "${PREFIX_PATH}/${path}" "${PREFIX_PATH}/.${path}" + ln -fs "${PREFIX_PATH}/Python.framework/Versions/Current/${path}" "${PREFIX_PATH}/${path}" + find "${PREFIX_PATH}/.${path}" -type l -delete + for file in "${PREFIX_PATH}/.${path}/"*; do + [ -e "${file}" ] && cp -fR "${file}" "${PREFIX_PATH}/${path}" + done + rm -fr "${PREFIX_PATH}/.${path}" + done + fi if [ ! -e "${PREFIX_PATH}/bin/python" ] && [ -e "${PREFIX_PATH}/bin/${python}" ]; then ( cd "${PREFIX_PATH}/bin" && ln -fs "${python}" "python" ) fi @@ -1330,6 +1343,10 @@ if [[ "$CONFIGURE_OPTS" == *"--enable-shared"* ]] || [[ "$PYTHON_CONFIGURE_OPTS" fi fi +if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then + package_option python configure --enable-framework="${PREFIX_PATH}" +fi + SEED="$(date "+%Y%m%d%H%M%S").$$" LOG_PATH="${TMP}/python-build.${SEED}.log" PYTHON_BIN="${PREFIX_PATH}/bin/python" From bf94eb8cbecf294ef7b115029d09917e82761e73 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Sat, 18 Jan 2014 02:46:13 +0900 Subject: [PATCH 2/2] Add workaround for `--enable-framework` to work with CPython 2.7.6 --- plugins/python-build/bin/python-build | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 1f3f1ea7..9f724e62 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1063,17 +1063,9 @@ build_package_verify_python() { local package_name="$1" local python="$2" if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then - local path file - for path in bin include lib share; do - mkdir -p "${PREFIX_PATH}/${path}" - mv -f "${PREFIX_PATH}/${path}" "${PREFIX_PATH}/.${path}" - ln -fs "${PREFIX_PATH}/Python.framework/Versions/Current/${path}" "${PREFIX_PATH}/${path}" - find "${PREFIX_PATH}/.${path}" -type l -delete - for file in "${PREFIX_PATH}/.${path}/"*; do - [ -e "${file}" ] && cp -fR "${file}" "${PREFIX_PATH}/${path}" - done - rm -fr "${PREFIX_PATH}/.${path}" - done + # Only symlinks are installed in ${PREFIX_PATH}/bin + rm -fr "${PREFIX_PATH}/bin" + ln -fs "${PREFIX_PATH}/Python.framework/Versions/Current/bin" "${PREFIX_PATH}/bin" fi if [ ! -e "${PREFIX_PATH}/bin/python" ] && [ -e "${PREFIX_PATH}/bin/${python}" ]; then ( cd "${PREFIX_PATH}/bin" && ln -fs "${python}" "python" ) @@ -1344,6 +1336,17 @@ if [[ "$CONFIGURE_OPTS" == *"--enable-shared"* ]] || [[ "$PYTHON_CONFIGURE_OPTS" fi if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then + 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") + 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}" + done + } + create_framework_dirs "${DEFINITION_PATH##*/}" package_option python configure --enable-framework="${PREFIX_PATH}" fi