From 3ec59d6454cb078a2a071ca9bd747ed17c92d569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 15 Jan 2026 14:37:11 +0100 Subject: [PATCH 1/5] Use sysconfigdata from shared library build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the sysconfigdata from the shared library build rather than the static one. The main difference is that this ensures that programs link to the shared Python library rather than the static library. Other differences are mostly superficial (build directories, test invocation commands). Fixes #565 Signed-off-by: Michał Górny --- recipe/build_base.sh | 4 +++- recipe/meta.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/recipe/build_base.sh b/recipe/build_base.sh index a376602ca..8f32b42cb 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -395,7 +395,9 @@ if [[ ${target_platform} =~ .*linux.* ]]; then ln -sf ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}.1.0 ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} fi -SYSCONFIG=$(find ${_buildd_static}/$(cat ${_buildd_static}/pybuilddir.txt) -name "_sysconfigdata*.py" -print0) +# Use sysconfigdata from shared build, as we want packages to prefer linking against the shared library. +# Issue #565. +SYSCONFIG=$(find ${_buildd_shared}/$(cat ${_buildd_shared}/pybuilddir.txt) -name "_sysconfigdata*.py" -print0) cat ${SYSCONFIG} | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ "${_FLAGS_REPLACE[@]}" \ > ${PREFIX}/lib/python${VERABI_NO_DBG}/$(basename ${SYSCONFIG}) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 1b26b7a00..17b8d6e7b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -4,7 +4,7 @@ {% set ver2 = '.'.join(version.split('.')[0:2]) %} {% set ver2nd = ''.join(version.split('.')[0:2]) %} {% set ver3nd = ''.join(version.split('.')[0:3]) %} -{% set build_number = 0 %} +{% set build_number = 1 %} # this makes the linter happy {% set channel_targets = channel_targets or 'conda-forge main' %} From 1962ad19cfcf5490fb098ea332aff2da5106acb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 15 Jan 2026 14:39:45 +0100 Subject: [PATCH 2/5] MNT: Re-rendered with conda-smithy 3.54.1 and conda-forge-pinning 2026.01.13.21.47.52 Other tools: - conda-build 25.11.1 - rattler-build 0.55.0 - rattler-build-conda-compat 1.4.10 --- .scripts/run_osx_build.sh | 19 +++++++++++++++++++ README.md | 16 ++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index 361edeb2c..bac7141a9 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -63,6 +63,25 @@ if [[ "${sha:-}" == "" ]]; then sha=$(git rev-parse HEAD) fi +if [[ "${OSX_SDK_DIR:-}" == "" ]]; then + if [[ "${CI:-}" == "" ]]; then + echo "Please set OSX_SDK_DIR to a directory where SDKs can be downloaded to. Aborting" + exit 1 + else + export OSX_SDK_DIR=/opt/conda-sdks + /usr/bin/sudo mkdir -p "${OSX_SDK_DIR}" + /usr/bin/sudo chown "${USER}" "${OSX_SDK_DIR}" + fi +else + if tmpf=$(mktemp -p "$OSX_SDK_DIR" tmp.XXXXXXXX 2>/dev/null); then + rm -f "$tmpf" + echo "OSX_SDK_DIR is writeable without sudo, continuing" + else + echo "User-provided OSX_SDK_DIR is not writeable for current user! Aborting" + exit 1 + fi +fi + echo -e "\n\nRunning the build setup script." source run_conda_forge_build_setup diff --git a/README.md b/README.md index 78eed68b8..48d0ae387 100644 --- a/README.md +++ b/README.md @@ -235,14 +235,14 @@ Current release info Installing python ================= -Installing `python` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with: +Installing `python` from the `conda-forge/label/python_debug` channel can be achieved by adding `conda-forge/label/python_debug` to your channels with: ``` -conda config --add channels conda-forge +conda config --add channels conda-forge/label/python_debug conda config --set channel_priority strict ``` -Once the `conda-forge` channel has been enabled, `cpython, libpython-static, python, python-freethreading, python-gil, python-jit` can be installed with `conda`: +Once the `conda-forge/label/python_debug` channel has been enabled, `cpython, libpython-static, python, python-freethreading, python-gil, python-jit` can be installed with `conda`: ``` conda install cpython libpython-static python python-freethreading python-gil python-jit @@ -257,26 +257,26 @@ mamba install cpython libpython-static python python-freethreading python-gil py It is possible to list all of the versions of `cpython` available on your platform with `conda`: ``` -conda search cpython --channel conda-forge +conda search cpython --channel conda-forge/label/python_debug ``` or with `mamba`: ``` -mamba search cpython --channel conda-forge +mamba search cpython --channel conda-forge/label/python_debug ``` Alternatively, `mamba repoquery` may provide more information: ``` # Search all versions available on your platform: -mamba repoquery search cpython --channel conda-forge +mamba repoquery search cpython --channel conda-forge/label/python_debug # List packages depending on `cpython`: -mamba repoquery whoneeds cpython --channel conda-forge +mamba repoquery whoneeds cpython --channel conda-forge/label/python_debug # List dependencies of `cpython`: -mamba repoquery depends cpython --channel conda-forge +mamba repoquery depends cpython --channel conda-forge/label/python_debug ``` From be89df86d7a343d5fd1118a6bf14dd09b37a3b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 15 Jan 2026 16:26:26 +0100 Subject: [PATCH 3/5] Also use shared-lib `build-details.json` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- recipe/build_base.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipe/build_base.sh b/recipe/build_base.sh index 8f32b42cb..6f48b68a7 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -395,12 +395,15 @@ if [[ ${target_platform} =~ .*linux.* ]]; then ln -sf ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}.1.0 ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} fi -# Use sysconfigdata from shared build, as we want packages to prefer linking against the shared library. -# Issue #565. -SYSCONFIG=$(find ${_buildd_shared}/$(cat ${_buildd_shared}/pybuilddir.txt) -name "_sysconfigdata*.py" -print0) +# Use sysconfigdata and build-details.json from the shared build, as we want packages to prefer +# linking against the shared library. Issue #565. +BUILD_DIR=$(< ${_buildd_shared}/pybuilddir.txt) +SYSCONFIG=$(find ${_buildd_shared}/${BUILD_DIR} -name "_sysconfigdata*.py" -print0) cat ${SYSCONFIG} | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ "${_FLAGS_REPLACE[@]}" \ > ${PREFIX}/lib/python${VERABI_NO_DBG}/$(basename ${SYSCONFIG}) +BUILD_DETAILS=${_buildd_shared}/${BUILD_DIR}/build-details.json +cp ${BUILD_DETAILS} ${PREFIX}/lib/python${VERABI_NO_DBG}/ MAKEFILE=$(find ${PREFIX}/lib/python${VERABI_NO_DBG}/ -path "*config-*/Makefile" -print0) cp ${MAKEFILE} /tmp/Makefile-$$ cat /tmp/Makefile-$$ | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ From e09a046c014c3f53881c9fabb61bf48595e3f279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 16 Jan 2026 17:34:06 +0100 Subject: [PATCH 4/5] Add missing ripgrep dep to the test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 17b8d6e7b..aa305896e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -307,6 +307,7 @@ outputs: requires: - {{ stdlib('c') }} - {{ compiler('c') }} + - ripgrep commands: - VER=${PKG_VERSION%.*} # [not win] - VERABI=${VER} # [not win] From 5953d4c76eee45017149b40fe2f0d6981552506d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 16 Jan 2026 17:42:42 +0100 Subject: [PATCH 5/5] Fix the linking test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now python3-config defaults to shared linking, so perform that part of the test first. Then remove the shared libraries to force static linking. Signed-off-by: Michał Górny --- .../prefix-replacement/build-and-test.sh | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/recipe/tests/prefix-replacement/build-and-test.sh b/recipe/tests/prefix-replacement/build-and-test.sh index 633b741a3..851d74fa2 100644 --- a/recipe/tests/prefix-replacement/build-and-test.sh +++ b/recipe/tests/prefix-replacement/build-and-test.sh @@ -2,32 +2,7 @@ set -ex -if [[ "$PKG_NAME" == "libpython-static" ]]; then - # see bpo44182 for why -L${CONDA_PREFIX}/lib is added - ${CC} a.c $(python3-config --cflags) $(python3-config --embed --ldflags) -L${CONDA_PREFIX}/lib -o ${CONDA_PREFIX}/bin/embedded-python-static - if [[ "$target_platform" == linux-* ]]; then - if ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then - echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." - fi - elif [[ "$target_platform" == osx-* ]]; then - if ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then - echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." - fi - fi - ${CONDA_PREFIX}/bin/embedded-python-static - - # I thought this would prefer the shared library for Python. I was wrong: - # EMBED_LDFLAGS=$(python3-config --ldflags) - # re='^(.*)(-lpython[^ ]*)(.*)$' - # if [[ ${EMBED_LDFLAGS} =~ $re ]]; then - # EMBED_LDFLAGS="${BASH_REMATCH[1]} ${BASH_REMATCH[3]} -Wl,-Bdynamic ${BASH_REMATCH[2]}" - # fi - # ${CC} a.c $(python3-config --cflags) ${EMBED_LDFLAGS} -o ${CONDA_PREFIX}/bin/embedded-python-shared - - # Brute-force way of linking to the shared library, sorry! - rm -rf ${CONDA_PREFIX}/lib/libpython*.a -fi - +# see bpo44182 for why -L${CONDA_PREFIX}/lib is added ${CC} a.c $(python3-config --cflags) \ $(python3-config --embed --ldflags) \ -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib \ @@ -44,4 +19,24 @@ elif [[ "$target_platform" == osx-* ]]; then fi ${CONDA_PREFIX}/bin/embedded-python-shared +if [[ "$PKG_NAME" == "libpython-static" ]]; then + # remove the shared library to force static linking + rm -f ${CONDA_PREFIX}/lib/libpython*.{so,dylib} + + ${CC} a.c $(python3-config --cflags) \ + $(python3-config --embed --ldflags) \ + -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib \ + -o ${CONDA_PREFIX}/bin/embedded-python-static + if [[ "$target_platform" == linux-* ]]; then + if ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then + echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." + fi + elif [[ "$target_platform" == osx-* ]]; then + if ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-static | rg libpython; then + echo "ERROR :: Embedded python linked to shared python library. It is expected to link to the static library." + fi + fi + ${CONDA_PREFIX}/bin/embedded-python-static +fi + set +x