From b3d52b05d288deeeee56b2eb82637be0f9e069f7 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Thu, 8 Dec 2022 12:17:53 +0300 Subject: [PATCH 1/5] --enable-shared by default on non-mac systems --- plugins/python-build/bin/python-build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 797ab75f..fadbd1fa 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -806,6 +806,9 @@ build_package_standard_build() { use_homebrew_zlib || true fi use_dsymutil || true + if ! is_mac; then + build_package_enable_shared || true + fi fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then From cf50e2a2dbdb9bdae6cbffb5bc77d2efb14d9f9a Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Fri, 9 Dec 2022 11:41:26 +0300 Subject: [PATCH 2/5] Don't hide output from extension checks --- plugins/python-build/bin/python-build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index fadbd1fa..caed6fd9 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1791,7 +1791,7 @@ verify_python() { } try_python_module() { - if ! "$PYTHON_BIN" -c "import $1" 1>/dev/null 2>&1; then + if ! "$PYTHON_BIN" -c "import $1"; then { colorize 1 "WARNING" echo ": The Python $1 extension was not compiled${3:+ $3}. Missing the ${2:-$1}?" return 0 @@ -1800,7 +1800,7 @@ try_python_module() { } verify_python_module() { - if ! "$PYTHON_BIN" -c "import $1" 1>/dev/null 2>&1; then + if ! "$PYTHON_BIN" -c "import $1"; then { colorize 1 "ERROR" echo ": The Python $1 extension was not compiled. Missing the ${2:-$1}?" echo From 03bba03291a1d6535145e894e71dfeb772823db3 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Fri, 9 Dec 2022 16:52:47 +0300 Subject: [PATCH 3/5] Set --enable-shared earlier To take advantage of the existing logic to add to rpath --- plugins/python-build/bin/python-build | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index caed6fd9..739bac43 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -806,9 +806,6 @@ build_package_standard_build() { use_homebrew_zlib || true fi use_dsymutil || true - if ! is_mac; then - build_package_enable_shared || true - fi fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then @@ -2191,11 +2188,15 @@ if [ -n "$DEBUG" ]; then package_option python configure --with-pydebug fi +if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" != *"--enable-framework"* ]]; then + package_option python configure --enable-shared +fi + # python-build: Specify `--libdir` on configure to fix build on openSUSE (#36) package_option python configure --libdir="${PREFIX_PATH}/lib" # python-build: Set `RPATH` if `--enable-shared` was given (#65, #66, #82) -if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-shared"* ]]; then +if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS ${PYTHON_CONFIGURE_OPTS_ARRAY[@]}" == *"--enable-shared"* ]]; then # The ld on Darwin embeds the full paths to each dylib by default if [[ "$LDFLAGS" != *"-rpath="* ]] && ! is_mac; then export LDFLAGS="-Wl,-rpath=${PREFIX_PATH}/lib ${LDFLAGS}" From 79fdf1e3bbbd5a66701799def3d588e19ce24f66 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Fri, 9 Dec 2022 16:58:44 +0300 Subject: [PATCH 4/5] Improve Mac feature messages phrasing --- plugins/python-build/bin/python-build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 739bac43..5e7080c8 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -2211,7 +2211,7 @@ fi # Add support for framework installation (`--enable-framework`) of CPython (#55, #99) if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then if ! is_mac; then - echo "python-build: framework installation is not supported." >&2 + echo "python-build: framework installation is not supported outside of MacOS." >&2 exit 1 fi create_framework_dirs() { @@ -2232,7 +2232,7 @@ fi # Build against universal SDK if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then if ! is_mac; then - echo "python-build: universal installation is not supported." >&2 + echo "python-build: universal installation is not supported outside of MacOS." >&2 exit 1 fi package_option python configure --enable-universalsdk=/ From ca1593c80eae0b84349ca163699b71b04ea8b9fa Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Fri, 23 Dec 2022 10:55:13 +0300 Subject: [PATCH 5/5] Fix build tests --- plugins/python-build/test/build.bats | 112 +++++++++++------------ plugins/python-build/test/compiler.bats | 6 +- plugins/python-build/test/pyenv_ext.bats | 28 +++--- 3 files changed, 72 insertions(+), 74 deletions(-) diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index 649af776..f9c9a0a9 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -62,7 +62,7 @@ assert_build_log() { cached_tarball "yaml-0.1.6" cached_tarball "Python-3.6.2" - for i in {1..9}; do stub uname '-s : echo Linux'; done + for i in {1..10}; do stub uname '-s : echo Linux'; done stub brew false stub_make_install stub_make_install @@ -74,12 +74,12 @@ assert_build_log() { unstub make assert_build_log <>"$tcl_tk_libdir/lib/tclConfig.sh" - for i in {1..9}; do stub uname '-s : echo Darwin'; done + for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub brew false @@ -370,7 +370,7 @@ DEF assert_build_log <> build.log' stub_make_install @@ -681,8 +681,8 @@ DEF assert_build_log <> build.log" \ " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" @@ -324,8 +324,8 @@ EOS assert_success assert_build_log <