From be7de471cd53e8c59daa78341ff2946b19f1180c Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Wed, 26 Nov 2025 20:08:03 +0100 Subject: [PATCH 01/11] Expand OpenSSL version check --- recipe/meta.yaml | 3 +++ recipe/run_test.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 51a1afcb2..2dc855287 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -210,6 +210,9 @@ outputs: - ripgrep - cmake - ninja + # Pin to the openssl version used during the build to check whether + # we load the conda-forge version. + - openssl {{ openssl }} - {{ stdlib('c') }} - {{ compiler('c') }} # Tried to use enable_language(C) to avoid needing this. It does not work. diff --git a/recipe/run_test.py b/recipe/run_test.py index bbe13e465..33be79209 100644 --- a/recipe/run_test.py +++ b/recipe/run_test.py @@ -102,8 +102,8 @@ import ssl print('OPENSSL_VERSION:', ssl.OPENSSL_VERSION) -CONDA_OPENSSL_VERSION = os.getenv('openssl').split(".")[0] -assert CONDA_OPENSSL_VERSION in ssl.OPENSSL_VERSION +CONDA_OPENSSL_VERSION = os.getenv('openssl') +assert CONDA_OPENSSL_VERSION in ssl.OPENSSL_VERSION, f"{CONDA_OPENSSL_VERSION} not found in {ssl.OPENSSL_VERSION}" # See https://github.com/conda-forge/python-feedstock/issues/718 for context: assert sys.hash_info.algorithm.startswith("siphash") From ab9c4dfa624d92c691e1cde66c8467e778d624bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 22 Jan 2026 15:59:51 +0100 Subject: [PATCH 02/11] Split shared Python library to `libpython` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #843 Signed-off-by: Michał Górny --- recipe/build_base.sh | 10 --- recipe/build_shared.bat | 0 recipe/build_shared.sh | 33 +++++++ recipe/meta.yaml | 87 ++++++++++++++++--- recipe/tests/cmake/CMakeLists.txt | 14 +-- .../prefix-replacement/build-and-test.sh | 77 ++++++++-------- 6 files changed, 150 insertions(+), 71 deletions(-) create mode 100644 recipe/build_shared.bat create mode 100644 recipe/build_shared.sh diff --git a/recipe/build_base.sh b/recipe/build_base.sh index dd5c15555..e52c83735 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -385,15 +385,6 @@ if [[ ${_OPTIMIZED} == yes ]]; then _FLAGS_REPLACE+=("") done fi -# Install the shared library (for people who embed Python only, e.g. GDB). -# Linking module extensions to this on Linux is redundant (but harmless). -# Linking module extensions to this on Darwin is harmful (multiply defined symbols). -shopt -s extglob -cp -pf ${_buildd_shared}/libpython*${SHLIB_EXT}!(.lto) ${PREFIX}/lib/ -shopt -u extglob -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) cat ${SYSCONFIG} | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ @@ -517,7 +508,6 @@ rm ${PREFIX}/lib/libpython${VERABI}.a if [[ ${PY_INTERP_DEBUG} == yes ]]; then rm ${PREFIX}/bin/python${VER} ln -s ${PREFIX}/bin/python${VERABI} ${PREFIX}/bin/python${VER} - ln -s ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} ${PREFIX}/lib/libpython${VERABI_NO_DBG}${SHLIB_EXT} ln -s ${PREFIX}/include/python${VERABI} ${PREFIX}/include/python${VER} fi diff --git a/recipe/build_shared.bat b/recipe/build_shared.bat new file mode 100644 index 000000000..e69de29bb diff --git a/recipe/build_shared.sh b/recipe/build_shared.sh new file mode 100644 index 000000000..35812a5d1 --- /dev/null +++ b/recipe/build_shared.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -ex + +_buildd_shared=build-shared +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + DBG=d +else + DBG= +fi +if [[ ${PY_FREETHREADING} == yes ]]; then + # This Python will not be usable with non-free threading Python modules. + THREAD=t +else + THREAD= +fi + +VER=${PKG_VERSION%.*} +ABIFLAGS=${DBG}${THREAD} +VERABI=${VER}${THREAD}${DBG} +VERABI_NO_DBG=${VER}${THREAD} + +# Install the shared library (for people who embed Python only, e.g. GDB). +# Linking module extensions to this on Linux is redundant (but harmless). +# Linking module extensions to this on Darwin is harmful (multiply defined symbols). +shopt -s extglob +cp -pf ${_buildd_shared}/libpython*${SHLIB_EXT}!(.lto) ${PREFIX}/lib/ +shopt -u extglob +if [[ ${target_platform} =~ .*linux.* ]]; then + ln -sf ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}.1.0 ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} +fi +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + ln -s ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT} ${PREFIX}/lib/libpython${VERABI_NO_DBG}${SHLIB_EXT} +fi diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 2dc855287..b58c39ed7 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -222,7 +222,6 @@ outputs: files: - tests/cmake/* - tests/cython/* - - tests/prefix-replacement/* - run_test.py commands: - echo on # [win] @@ -248,8 +247,11 @@ outputs: - _CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_conda_linux_gnu python -c "import sysconfig; print(sysconfig.get_config_var('CC'))" # [linux64] # check for unreplaced @ symbols in sysconfig files, excluding e.g. '"$@".lto' - for f in ${CONDA_PREFIX}/lib/python*/_sysconfig*.py; do echo "Checking $f:"; if [[ `rg @[^@]*@ $f` ]]; then echo "FAILED ON $f"; cat $f; exit 1; fi; done # [linux64 or osx] - - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix] - - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.so # [unix] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.so # [linux] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.dylib # [osx] + - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix] {% if freethreading == "yes" %} - if not exist %PREFIX%\\libs\\python3t.lib exit 1 # [win] - if not exist %PREFIX%\\libs\\python{{ ver2nd }}t.lib exit 1 # [win] @@ -266,14 +268,8 @@ outputs: - if not exist %PREFIX%\\Scripts\\pydoc.exe exit 1 # [win] - if not exist %PREFIX%\\include\\pyconfig.h exit 1 # [win] - pushd tests - - pushd prefix-replacement # [unix] - - bash build-and-test.sh # [unix] - - popd # [unix] - pushd cmake -{% if freethreading == "no" %} - # TODO: use the new FindPython3 which supports freethreading - - cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . -{% endif %} + - cmake -GNinja -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Module" --debug-find --trace --debug-output --debug-trycompile . - popd - popd - python run_test.py @@ -284,6 +280,61 @@ outputs: # Test for wide character supported via ncursesw - TERM=xterm >/dev/null python -c "import curses; scr = curses.initscr(); curses.unget_wch('x'); assert 'x' == scr.get_wch()" # [unix] + - name: libpython + script: build_shared.sh # [unix] + script: build_shared.bat # [win] + build: + number: {{ build_number }} + activate_in_script: true + ignore_run_exports: + - python_abi + script_env: + - PY_INTERP_DEBUG={{ py_interp_debug }} + - PY_FREETHREADING={{ freethreading }} + string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} + requirements: + build: + - {{ compiler('c') }} + - {{ stdlib('c') }} + - {{ compiler('cxx') }} + host: + - {{ pin_subpackage('python', exact=True) }} + run: + - {{ pin_subpackage('python', exact=True) }} + test: + files: + - tests/cmake/* + - tests/prefix-replacement/* + requires: + - {{ stdlib('c') }} + - {{ compiler('c') }} + # cmake expects a C++ compiler for some reason + - {{ compiler('cxx') }} + - ripgrep + - cmake + - ninja + commands: + - VER=${PKG_VERSION%.*} # [not win] + - VERABI=${VER} # [not win] +{% if freethreading == "yes" %} + - VERABI=${VERABI}t # [not win] +{% endif %} + - VERABI_NO_DBG=${VERABI} # [not win] +{% if py_interp_debug == "yes" %} + - VERABI=${VERABI}d # [not win] +{% endif %} + - test -f ${PREFIX}/lib/libpython${VERABI}.so # [linux] + - test -f ${PREFIX}/lib/libpython3.so # [linux and build_type == "release"] + - test -f ${PREFIX}/lib/libpython${VERABI}.dylib # [osx] + - pushd tests + - pushd prefix-replacement # [unix] + - bash build-and-test.sh # [unix] + - popd # [unix] + - pushd cmake + - cmake -GNinja -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" --debug-find --trace --debug-output --debug-trycompile . + - popd + - popd + - name: libpython-static script: build_static.sh # [unix] script: build_static.bat # [win] @@ -307,11 +358,16 @@ outputs: - {{ pin_subpackage('python', exact=True) }} test: files: + - tests/cmake/* - tests/prefix-replacement/* requires: - {{ stdlib('c') }} - {{ compiler('c') }} + # cmake expects a C++ compiler for some reason + - {{ compiler('cxx') }} - ripgrep + - cmake + - ninja commands: - VER=${PKG_VERSION%.*} # [not win] - VERABI=${VER} # [not win] @@ -325,9 +381,14 @@ outputs: - test -f ${PREFIX}/lib/libpython${VERABI}.a # [unix] - test -f ${PREFIX}/lib/libpython${VERABI_NO_DBG}.nolto.a # [unix] - test -f ${PREFIX}/lib/python${VERABI_NO_DBG}/config-${VERABI}-darwin/libpython${VERABI}.a # [osx] - - pushd tests/prefix-replacement # [unix] - - bash build-and-test.sh # [unix] - - popd # [unix] + - pushd tests + - pushd prefix-replacement # [unix] + - bash build-and-test.sh # [unix] + - popd # [unix] + - pushd cmake + - cmake -GNinja -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" --debug-find --trace --debug-output --debug-trycompile . + - popd + - popd - name: cpython build: diff --git a/recipe/tests/cmake/CMakeLists.txt b/recipe/tests/cmake/CMakeLists.txt index a13e20ae1..f3e41560c 100644 --- a/recipe/tests/cmake/CMakeLists.txt +++ b/recipe/tests/cmake/CMakeLists.txt @@ -1,16 +1,10 @@ -# https://martinopilia.com/posts/2018/09/15/building-python-extension.html -# FindPythonInterp and FindPythonLibs are deprecated since cmake 3.12 -# These can be replaced by find_package(Python ${PY_VER} REQUIRED) -# But these are still used by other packages, so we keep them. +# https://scikit-build-core.readthedocs.io/en/latest/guide/cmakelists.html#finding-python cmake_minimum_required(VERSION 3.10) enable_language(C) project(mymath) -option(PY_VER, "Python version to use") +option(PY_VER "Python version to use") +option(EXTRA_COMPONENTS "Additional Python components to check for") -find_package(PythonInterp ${PY_VER} REQUIRED) -# PATHS $ENV{CONDA_PREFIX} - -# This goes after, since it uses PythonInterp as hint -find_package(PythonLibs ${PY_VER} REQUIRED) +find_package(Python ${PY_VER} COMPONENTS Interpreter ${EXTRA_COMPONENTS} REQUIRED) diff --git a/recipe/tests/prefix-replacement/build-and-test.sh b/recipe/tests/prefix-replacement/build-and-test.sh index 633b741a3..d710bde75 100644 --- a/recipe/tests/prefix-replacement/build-and-test.sh +++ b/recipe/tests/prefix-replacement/build-and-test.sh @@ -2,46 +2,47 @@ 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 +case ${PKG_NAME} in + libpython) + # 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 \ + -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 + if [[ "$target_platform" == linux-* ]]; then + if ! ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then + echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." + fi + elif [[ "$target_platform" == osx-* ]]; then + if ! ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then + echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." + fi + fi + ${CONDA_PREFIX}/bin/embedded-python-shared + ;; -${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-shared + libpython-static) + ${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 + ;; -if [[ "$target_platform" == linux-* ]]; then - if ! ${READELF} -d ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then - echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." - fi -elif [[ "$target_platform" == osx-* ]]; then - if ! ${OTOOL} -l ${CONDA_PREFIX}/bin/embedded-python-shared | rg libpython; then - echo "ERROR :: Embedded python linked to static python library. We tried to force it to use the shared library." - fi -fi -${CONDA_PREFIX}/bin/embedded-python-shared + *) + # invalid package + exit 1 + ;; +esac set +x From 07c920642768904686c977ba99463d674466fa44 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 9 Aug 2026 15:22:01 +1100 Subject: [PATCH 03/11] add `-DCMAKE_POLICY_DEFAULT_CMP0094=NEW` to CMake tests --- recipe/meta.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index b58c39ed7..06c9d05f3 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -39,6 +39,15 @@ {% set site_packages_path = "lib/python" + ver2 + "/site-packages" %} {% endif %} +{% set cmake_test_args = "" %} +{% if unix %} + # for CMake invocations during testing, we need to avoid accidentally picking up python versions from + # the image, but we don't want to use `${CMAKE_ARGS}` from the compiler activation, because that contains + # `CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER`; while that's useful for building (i.e. don't look in `host:`, + # because we want to use binaries from `build:`), we want the exact opposite when running tests. + {% set cmake_test_args="-DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY -DCMAKE_FIND_ROOT_PATH=${PREFIX}" %} +{% endif %} + package: name: python-split version: {{ version }}{{ dev }} @@ -269,7 +278,7 @@ outputs: - if not exist %PREFIX%\\include\\pyconfig.h exit 1 # [win] - pushd tests - pushd cmake - - cmake -GNinja -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Module" --debug-find --trace --debug-output --debug-trycompile . + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Module" --debug-find --trace --debug-output --debug-trycompile . - popd - popd - python run_test.py @@ -331,7 +340,7 @@ outputs: - bash build-and-test.sh # [unix] - popd # [unix] - pushd cmake - - cmake -GNinja -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" --debug-find --trace --debug-output --debug-trycompile . + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" --debug-find --trace --debug-output --debug-trycompile . - popd - popd @@ -386,7 +395,7 @@ outputs: - bash build-and-test.sh # [unix] - popd # [unix] - pushd cmake - - cmake -GNinja -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" --debug-find --trace --debug-output --debug-trycompile . + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" --debug-find --trace --debug-output --debug-trycompile . - popd - popd From 3bcd01d74b7ad90dfb395ee340f5f6c6ce66c016 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 9 Aug 2026 16:16:06 +1100 Subject: [PATCH 04/11] tell CMake to accept the debug/freethreading ABI --- recipe/meta.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 06c9d05f3..d7c5e0ccd 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -46,6 +46,10 @@ # `CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER`; while that's useful for building (i.e. don't look in `host:`, # because we want to use binaries from `build:`), we want the exact opposite when running tests. {% set cmake_test_args="-DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=ONLY -DCMAKE_FIND_ROOT_PATH=${PREFIX}" %} + # CMake needs to be told that the debug/freethreading ABI is fine; the option takes a 4-tuple, + # Python_FIND_ABI=;;;; for details see + # https://cmake.org/cmake/help/latest/module/FindPython.html#hints + {% set cmake_test_args=cmake_test_args ~ " -DPython_FIND_ABI=\"" ~ ("ON" if build_type == "debug" else "OFF") ~ ";ANY;ANY;" ~ ("ON" if freethreading == "yes" else "OFF") ~ "\"" %} {% endif %} package: From 6bf953fde0daefc0ab425a062fb22331b34c66a9 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 9 Aug 2026 16:21:44 +1100 Subject: [PATCH 05/11] don't store build artifacts by default --- conda-forge.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/conda-forge.yml b/conda-forge.yml index 3a6ca1f90..3b7509423 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -17,6 +17,3 @@ provider: linux_aarch64: default osx_arm64: default test: native_and_emulated -workflow_settings: - store_build_artifacts: - - value: true From a35be725106a07b10ca17168164a4785e71afc9a Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 9 Aug 2026 19:13:02 +1100 Subject: [PATCH 06/11] bump build number --- recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index d7c5e0ccd..0c5ec0de6 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 = 2 %} +{% set build_number = 3 %} # this makes the linter happy {% set channel_targets = channel_targets or 'conda-forge main' %} From d310343ca763e6d7c086db510102184e5173aa82 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 9 Aug 2026 19:13:40 +1100 Subject: [PATCH 07/11] update or remove obsolete pins in CBC --- recipe/conda_build_config.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index 9d84028dd..97658c608 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,5 +1,3 @@ -MACOSX_SDK_VERSION: # [osx and x86_64] - - 11.0 # [osx and x86_64] # See https://docs.python.org/3.14/whatsnew/3.14.html#a-new-type-of-interpreter c_compiler_version: # [osx] - 20.1 # [osx] @@ -10,7 +8,7 @@ cxx_compiler_version: # [osx] python: - 3.14 numpy: - - 1.16 + - 2 python_impl: - cpython is_python_min: From f5d23c31507eb5975812adbddf59ed4c633bec6b Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 13 Aug 2026 06:56:50 +1100 Subject: [PATCH 08/11] MNT: Re-rendered with conda-smithy 2026.8.9 and conda-forge-pinning 2026.08.12.13.59.02 Other tools: - conda-build 26.7.0 - rattler-build 0.72.2 - rattler-build-conda-compat 1.4.19 --- .azure-pipelines/azure-pipelines-osx.yml | 55 ++-------- .github/workflows/conda-build.yml | 126 +++------------------- .scripts/create_conda_build_artifacts.bat | 78 -------------- .scripts/create_conda_build_artifacts.sh | 114 -------------------- README.md | 25 ++--- 5 files changed, 38 insertions(+), 360 deletions(-) delete mode 100755 .scripts/create_conda_build_artifacts.bat delete mode 100755 .scripts/create_conda_build_artifacts.sh diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 3dcf9383d..00cdd8c15 100644 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -16,9 +16,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_64_build_typedebugchannel_targetscon_h5e478946 osx_64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes: CONFIG: osx_64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes UPLOAD_PACKAGES: 'True' @@ -27,9 +26,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_64_build_typedebugchannel_targetscon_h116d3356 osx_64_build_typereleasechannel_targetsconda-forge_mainfreethreadingno: CONFIG: osx_64_build_typereleasechannel_targetsconda-forge_mainfreethreadingno UPLOAD_PACKAGES: 'True' @@ -38,9 +36,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_64_build_typereleasechannel_targetsc_h425d4db0 osx_64_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes: CONFIG: osx_64_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes UPLOAD_PACKAGES: 'True' @@ -49,9 +46,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_64_build_typereleasechannel_targetsc_haa8f77b8 osx_arm64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingno: CONFIG: osx_arm64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingno UPLOAD_PACKAGES: 'True' @@ -60,9 +56,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_arm64_build_typedebugchannel_targets_h4a1f0d05 osx_arm64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes: CONFIG: osx_arm64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes UPLOAD_PACKAGES: 'True' @@ -71,9 +66,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_arm64_build_typedebugchannel_targets_h49dbe0c1 osx_arm64_build_typereleasechannel_targetsconda-forge_mainfreethreadingno: CONFIG: osx_arm64_build_typereleasechannel_targetsconda-forge_mainfreethreadingno UPLOAD_PACKAGES: 'True' @@ -82,9 +76,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_arm64_build_typereleasechannel_targe_h0d9a29af osx_arm64_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes: CONFIG: osx_arm64_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes UPLOAD_PACKAGES: 'True' @@ -93,9 +86,8 @@ jobs: free_disk_space: skip pagefile_size: 0 resize_partitions: false - store_build_artifacts: true + store_build_artifacts: false tools_install_dir: ~/miniforge3 - CONFIG_SHORT: osx_arm64_build_typereleasechannel_targe_h92a1d5a6 timeoutInMinutes: 360 variables: {} @@ -122,34 +114,3 @@ jobs: BINSTAR_TOKEN: $(BINSTAR_TOKEN) FEEDSTOCK_TOKEN: $(FEEDSTOCK_TOKEN) STAGING_BINSTAR_TOKEN: $(STAGING_BINSTAR_TOKEN) - - - script: | - export ARTIFACT_STAGING_DIR="$(Build.ArtifactStagingDirectory)" - # Archive everything in CONDA_BLD_PATH except environments - export BLD_ARTIFACT_PREFIX=conda_artifacts - export CI=azure - export CI_RUN_ID=$(build.BuildNumber).$(system.JobAttempt) - export CONDA_BLD_PATH=$(build_workspace_dir) - export FEEDSTOCK_NAME=$(basename ${BUILD_REPOSITORY_NAME}) - export MINIFORGE_HOME=$(tools_install_dir) - if [[ "$AGENT_JOBSTATUS" == "Failed" ]]; then - # Archive the CONDA_BLD_PATH environments only when the job fails - export ENV_ARTIFACT_PREFIX=conda_envs - fi - ./.scripts/create_conda_build_artifacts.sh - displayName: Prepare conda build artifacts - condition: and(succeededOrFailed(), eq(variables.store_build_artifacts, true)) - - - task: PublishPipelineArtifact@1 - displayName: Store conda build artifacts - condition: not(eq(variables.BLD_ARTIFACT_PATH, '')) - inputs: - targetPath: $(BLD_ARTIFACT_PATH) - artifactName: $(BLD_ARTIFACT_NAME) - - - task: PublishPipelineArtifact@1 - displayName: Store conda build environment artifacts - condition: not(eq(variables.ENV_ARTIFACT_PATH, '')) - inputs: - targetPath: $(ENV_ARTIFACT_PATH) - artifactName: $(ENV_ARTIFACT_NAME) diff --git a/.github/workflows/conda-build.yml b/.github/workflows/conda-build.yml index 251790e66..04e27914e 100644 --- a/.github/workflows/conda-build.yml +++ b/.github/workflows/conda-build.yml @@ -23,9 +23,8 @@ jobs: matrix: include: - CONFIG: linux_64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingno - CONFIG_SHORT: linux_64_build_typedebugchannel_targetsc_h10d856d4 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -36,9 +35,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes - CONFIG_SHORT: linux_64_build_typedebugchannel_targetsc_hf83d9e2d DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -49,9 +47,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_64_build_typereleasechannel_targetsconda-forge_mainfreethreadingno - CONFIG_SHORT: linux_64_build_typereleasechannel_target_h01f3c156 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -62,9 +59,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_64_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes - CONFIG_SHORT: linux_64_build_typereleasechannel_target_hf5ff4d16 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -75,9 +71,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingno - CONFIG_SHORT: linux_aarch64_build_typedebugchannel_tar_hd2db0a21 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-aarch64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -88,9 +83,8 @@ jobs: runs_on: ['ubuntu-24.04-arm'] tools_install_dir: ~/miniforge3 - CONFIG: linux_aarch64_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes - CONFIG_SHORT: linux_aarch64_build_typedebugchannel_tar_h51de9693 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-aarch64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -101,9 +95,8 @@ jobs: runs_on: ['ubuntu-24.04-arm'] tools_install_dir: ~/miniforge3 - CONFIG: linux_aarch64_build_typereleasechannel_targetsconda-forge_mainfreethreadingno - CONFIG_SHORT: linux_aarch64_build_typereleasechannel_t_hccc48f4a DOCKER_IMAGE: quay.io/condaforge/linux-anvil-aarch64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -114,9 +107,8 @@ jobs: runs_on: ['ubuntu-24.04-arm'] tools_install_dir: ~/miniforge3 - CONFIG: linux_aarch64_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes - CONFIG_SHORT: linux_aarch64_build_typereleasechannel_t_h78d2c7f5 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-aarch64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -127,9 +119,8 @@ jobs: runs_on: ['ubuntu-24.04-arm'] tools_install_dir: ~/miniforge3 - CONFIG: linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingno - CONFIG_SHORT: linux_ppc64le_build_typedebugchannel_tar_hac8bb296 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -140,9 +131,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_ppc64le_build_typedebugchannel_targetsconda-forge_python_debugfreethreadingyes - CONFIG_SHORT: linux_ppc64le_build_typedebugchannel_tar_hb74ed675 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -153,9 +143,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_ppc64le_build_typereleasechannel_targetsconda-forge_mainfreethreadingno - CONFIG_SHORT: linux_ppc64le_build_typereleasechannel_t_h5454d1d5 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -166,9 +155,8 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: linux_ppc64le_build_typereleasechannel_targetsconda-forge_mainfreethreadingyes - CONFIG_SHORT: linux_ppc64le_build_typereleasechannel_t_hed84b2c3 DOCKER_IMAGE: quay.io/condaforge/linux-anvil-x86_64:alma10 - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_workspace_dir: build_artifacts docker_run_args: @@ -179,8 +167,7 @@ jobs: runs_on: ['ubuntu-latest'] tools_install_dir: ~/miniforge3 - CONFIG: win_64_freethreadingno - CONFIG_SHORT: win_64_freethreadingno - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_platform: win-64 build_workspace_dir: D:\\bld\\ @@ -192,8 +179,7 @@ jobs: runs_on: ['windows-2022'] tools_install_dir: D:\Miniforge - CONFIG: win_64_freethreadingyes - CONFIG_SHORT: win_64_freethreadingyes - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_platform: win-64 build_workspace_dir: D:\\bld\\ @@ -205,8 +191,7 @@ jobs: runs_on: ['windows-2022'] tools_install_dir: D:\Miniforge - CONFIG: win_arm64_freethreadingno - CONFIG_SHORT: win_arm64_freethreadingno - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_platform: win-64 build_workspace_dir: D:\\bld\\ @@ -218,8 +203,7 @@ jobs: runs_on: ['windows-2022'] tools_install_dir: D:\Miniforge - CONFIG: win_arm64_freethreadingyes - CONFIG_SHORT: win_arm64_freethreadingyes - STORE_BUILD_ARTIFACTS: True + STORE_BUILD_ARTIFACTS: False UPLOAD_PACKAGES: True build_platform: win-64 build_workspace_dir: D:\\bld\\ @@ -325,80 +309,4 @@ jobs: RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true' BINSTAR_TOKEN: ${{ secrets.BINSTAR_TOKEN }} FEEDSTOCK_TOKEN: ${{ secrets.FEEDSTOCK_TOKEN }} - STAGING_BINSTAR_TOKEN: ${{ secrets.STAGING_BINSTAR_TOKEN }} - - - name: Determine build outcome - # this is to merge the status of the linux/osx/win builds into - # something we can easily reuse during artefact generation - id: determine-status - if: ${{ always() }} - shell: bash - env: - OS: ${{ matrix.os }} - run: | - if [[ "$OS" == "ubuntu" ]]; then - STATUS=${{ steps.build-linux.outcome }} - elif [[ "$OS" == "macos" ]]; then - STATUS=${{ steps.build-macos.outcome }} - elif [[ "$OS" == "windows" ]]; then - STATUS=${{ steps.build-windows.outcome }} - fi - if [ -z "$STATUS" ]; then - # steps that never ran will have empty status - STATUS="cancelled" - fi - echo "status=$STATUS" >> $GITHUB_OUTPUT - - - name: Prepare conda build artifacts - continue-on-error: true - id: prepare-artifacts - shell: bash - # we do not want to trigger artefact creation if the build was cancelled - if: ${{ always() && steps.determine-status.outputs.status != 'cancelled' && matrix.STORE_BUILD_ARTIFACTS }} - env: - CI: github_actions - CONDA_BLD_PATH: ${{ matrix.build_workspace_dir }} - CONFIG: ${{ matrix.CONFIG }} - CONFIG_SHORT: ${{ matrix.CONFIG_SHORT }} - JOB_STATUS: ${{ steps.determine-status.outputs.status }} - OS: ${{ matrix.os }} - run: | - export ARTIFACT_STAGING_DIR="$GITHUB_WORKSPACE" - export CI_RUN_ID=$GITHUB_RUN_ID - export CONDA_BLD_PATH="${CONDA_BLD_PATH/#~/${HOME}}" - export FEEDSTOCK_NAME="$(basename $GITHUB_REPOSITORY)" - export MINIFORGE_HOME="${MINIFORGE_HOME/#~/${HOME}}" - # Archive everything in CONDA_BLD_PATH except environments - # Archive the CONDA_BLD_PATH environments only when the job fails - # Use different prefix for successful and failed build artifacts - # so random failures don't prevent rebuilds from creating artifacts. - if [ $JOB_STATUS == "failure" ]; then - export BLD_ARTIFACT_PREFIX="conda_artifacts" - export ENV_ARTIFACT_PREFIX="conda_envs" - else - export BLD_ARTIFACT_PREFIX="conda_pkgs" - fi - if [ $OS == "windows" ]; then - pwsh -Command ". '.scripts/create_conda_build_artifacts.bat'" - else - ./.scripts/create_conda_build_artifacts.sh - fi - - - name: Store conda build artifacts - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - if: ${{ always() && steps.prepare-artifacts.outcome == 'success' }} - with: - name: ${{ steps.prepare-artifacts.outputs.BLD_ARTIFACT_NAME }} - path: ${{ steps.prepare-artifacts.outputs.BLD_ARTIFACT_PATH }} - retention-days: 14 - continue-on-error: true - - - name: Store conda build environment artifacts - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - # only relevant if build failed, see above - if: ${{ always() && steps.determine-status.outputs.status == 'failure' && steps.prepare-artifacts.outcome == 'success' }} - with: - name: ${{ steps.prepare-artifacts.outputs.ENV_ARTIFACT_NAME }} - path: ${{ steps.prepare-artifacts.outputs.ENV_ARTIFACT_PATH }} - retention-days: 14 - continue-on-error: true \ No newline at end of file + STAGING_BINSTAR_TOKEN: ${{ secrets.STAGING_BINSTAR_TOKEN }} \ No newline at end of file diff --git a/.scripts/create_conda_build_artifacts.bat b/.scripts/create_conda_build_artifacts.bat deleted file mode 100755 index 705dc461b..000000000 --- a/.scripts/create_conda_build_artifacts.bat +++ /dev/null @@ -1,78 +0,0 @@ -setlocal enableextensions enabledelayedexpansion - -rem INPUTS (environment variables that need to be set before calling this script): -rem -rem CI (azure/github_actions/UNSET) -rem CI_RUN_ID (unique identifier for the CI job run) -rem CONDA_BLD_PATH (path to the conda-bld directory) -rem CONFIG (build matrix configuration string) -rem CONFIG_SHORT (uniquely-shortened configuration string) -rem FEEDSTOCK_NAME -rem Optional: -rem ARTIFACT_STAGING_DIR (use working directory if unset) -rem BLD_ARTIFACT_PREFIX (prefix for the conda build artifact name, skip if unset) -rem ENV_ARTIFACT_PREFIX (prefix for the conda build environments artifact name, skip if unset) - -rem OUTPUTS -rem -rem BLD_ARTIFACT_NAME -rem BLD_ARTIFACT_PATH -rem ENV_ARTIFACT_NAME -rem ENV_ARTIFACT_PATH - -rem Check that the conda-build directory exists -if not exist %CONDA_BLD_PATH% ( - echo conda-build directory does not exist - exit 1 -) - -if not defined ARTIFACT_STAGING_DIR ( - rem Set staging dir to the working dir - set ARTIFACT_STAGING_DIR=%cd% -) - -rem Set a unique ID for the artifact(s), specialized for this particular job run -set ARTIFACT_UNIQUE_ID=%CI_RUN_ID%_%CONFIG% -if not "%ARTIFACT_UNIQUE_ID%" == "%ARTIFACT_UNIQUE_ID:~0,80%" ( - set ARTIFACT_UNIQUE_ID=%CI_RUN_ID%_%CONFIG_SHORT% -) - -rem Make the build artifact zip -if defined BLD_ARTIFACT_PREFIX ( - set BLD_ARTIFACT_NAME=%BLD_ARTIFACT_PREFIX%_%ARTIFACT_UNIQUE_ID% - echo BLD_ARTIFACT_NAME: !BLD_ARTIFACT_NAME! - - set "BLD_ARTIFACT_PATH=%ARTIFACT_STAGING_DIR%\%FEEDSTOCK_NAME%_%BLD_ARTIFACT_PREFIX%_%ARCHIVE_UNIQUE_ID%.zip" - 7z a "!BLD_ARTIFACT_PATH!" "%CONDA_BLD_PATH%" -xr^^!.git/ -xr^^!_*_env*/ -xr^^!*_cache/ -bb - if errorlevel 1 exit 1 - echo BLD_ARTIFACT_PATH: !BLD_ARTIFACT_PATH! - - if "%CI%" == "azure" ( - echo ##vso[task.setVariable variable=BLD_ARTIFACT_NAME]!BLD_ARTIFACT_NAME! - echo ##vso[task.setVariable variable=BLD_ARTIFACT_PATH]!BLD_ARTIFACT_PATH! - ) - if "%CI%" == "github_actions" ( - echo BLD_ARTIFACT_NAME=!BLD_ARTIFACT_NAME!>> !GITHUB_OUTPUT! - echo BLD_ARTIFACT_PATH=!BLD_ARTIFACT_PATH!>> !GITHUB_OUTPUT! - ) -) - -rem Make the environments artifact zip -if defined ENV_ARTIFACT_PREFIX ( - set ENV_ARTIFACT_NAME=!ENV_ARTIFACT_PREFIX!_%ARTIFACT_UNIQUE_ID% - echo ENV_ARTIFACT_NAME: !ENV_ARTIFACT_NAME! - - set "ENV_ARTIFACT_PATH=%ARTIFACT_STAGING_DIR%\%FEEDSTOCK_NAME%_%ENV_ARTIFACT_PREFIX%_%ARCHIVE_UNIQUE_ID%.zip" - 7z a "!ENV_ARTIFACT_PATH!" -r "%CONDA_BLD_PATH%"/_*_env*/ -bb - if errorlevel 1 exit 1 - echo ENV_ARTIFACT_PATH: !ENV_ARTIFACT_PATH! - - if "%CI%" == "azure" ( - echo ##vso[task.setVariable variable=ENV_ARTIFACT_NAME]!ENV_ARTIFACT_NAME! - echo ##vso[task.setVariable variable=ENV_ARTIFACT_PATH]!ENV_ARTIFACT_PATH! - ) - if "%CI%" == "github_actions" ( - echo ENV_ARTIFACT_NAME=!ENV_ARTIFACT_NAME!>> !GITHUB_OUTPUT! - echo ENV_ARTIFACT_PATH=!ENV_ARTIFACT_PATH!>> !GITHUB_OUTPUT! - ) -) diff --git a/.scripts/create_conda_build_artifacts.sh b/.scripts/create_conda_build_artifacts.sh deleted file mode 100755 index 91095c05d..000000000 --- a/.scripts/create_conda_build_artifacts.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env bash - -# INPUTS (environment variables that need to be set before calling this script): -# -# CI (azure/github_actions/UNSET) -# CI_RUN_ID (unique identifier for the CI job run) -# CONDA_BLD_PATH (path to the conda-bld directory) -# CONFIG (build matrix configuration string) -# CONFIG_SHORT (uniquely-shortened configuration string) -# FEEDSTOCK_NAME -# Optional: -# ARTIFACT_STAGING_DIR (use working directory if unset) -# BLD_ARTIFACT_PREFIX (prefix for the conda build artifact name, skip if unset) -# ENV_ARTIFACT_PREFIX (prefix for the conda build environments artifact name, skip if unset) - -# OUTPUTS -# -# BLD_ARTIFACT_NAME -# BLD_ARTIFACT_PATH -# ENV_ARTIFACT_NAME -# ENV_ARTIFACT_PATH - -source .scripts/logging_utils.sh - -# DON'T do set -x, because it results in double echo-ing pipeline commands -# and that might end up inserting extraneous quotation marks in output variables -set -e - -# Check that the conda-build directory exists -if [ ! -d "$CONDA_BLD_PATH" ]; then - echo "conda-build directory does not exist" - exit 1 -fi - -# Set staging dir to the working dir, in Windows style if applicable -if [[ -z "${ARTIFACT_STAGING_DIR}" ]]; then - if pwd -W; then - ARTIFACT_STAGING_DIR=$(pwd -W) - else - ARTIFACT_STAGING_DIR=$PWD - fi -fi -echo "ARTIFACT_STAGING_DIR: $ARTIFACT_STAGING_DIR" - -FEEDSTOCK_ROOT=$(cd "$(dirname "$0")/.."; pwd;) -if [ -z ${FEEDSTOCK_NAME} ]; then - export FEEDSTOCK_NAME=$(basename ${FEEDSTOCK_ROOT}) -fi - -# Set a unique ID for the artifact(s), specialized for this particular job run -ARTIFACT_UNIQUE_ID="${CI_RUN_ID}_${CONFIG}" -if [[ ${#ARTIFACT_UNIQUE_ID} -gt 80 ]]; then - ARTIFACT_UNIQUE_ID="${CI_RUN_ID}_${CONFIG_SHORT}" -fi -echo "ARTIFACT_UNIQUE_ID: $ARTIFACT_UNIQUE_ID" - -# Set a descriptive ID for the archive(s), specialized for this particular job run -ARCHIVE_UNIQUE_ID="${CI_RUN_ID}_${CONFIG}" - -# Make the build artifact zip -if [[ ! -z "$BLD_ARTIFACT_PREFIX" ]]; then - export BLD_ARTIFACT_NAME="${BLD_ARTIFACT_PREFIX}_${ARTIFACT_UNIQUE_ID}" - export BLD_ARTIFACT_PATH="${ARTIFACT_STAGING_DIR}/${FEEDSTOCK_NAME}_${BLD_ARTIFACT_PREFIX}_${ARCHIVE_UNIQUE_ID}.zip" - - ( startgroup "Archive conda build directory" ) 2> /dev/null - - # Try 7z and fall back to zip if it fails (for cross-platform use) - if ! 7z a "$BLD_ARTIFACT_PATH" "$CONDA_BLD_PATH" '-xr!.git/' '-xr!_*_env*/' '-xr!*_cache/' -bb; then - pushd "$CONDA_BLD_PATH" - zip -r -y -T "$BLD_ARTIFACT_PATH" . -x '*.git/*' '*_*_env*/*' '*_cache/*' - popd - fi - - ( endgroup "Archive conda build directory" ) 2> /dev/null - - echo "BLD_ARTIFACT_NAME: $BLD_ARTIFACT_NAME" - echo "BLD_ARTIFACT_PATH: $BLD_ARTIFACT_PATH" - - if [[ "$CI" == "azure" ]]; then - echo "##vso[task.setVariable variable=BLD_ARTIFACT_NAME]$BLD_ARTIFACT_NAME" - echo "##vso[task.setVariable variable=BLD_ARTIFACT_PATH]$BLD_ARTIFACT_PATH" - elif [[ "$CI" == "github_actions" ]]; then - echo "BLD_ARTIFACT_NAME=$BLD_ARTIFACT_NAME" >> $GITHUB_OUTPUT - echo "BLD_ARTIFACT_PATH=$BLD_ARTIFACT_PATH" >> $GITHUB_OUTPUT - fi -fi - -# Make the environments artifact zip -if [[ ! -z "$ENV_ARTIFACT_PREFIX" ]]; then - export ENV_ARTIFACT_NAME="${ENV_ARTIFACT_PREFIX}_${ARTIFACT_UNIQUE_ID}" - export ENV_ARTIFACT_PATH="${ARTIFACT_STAGING_DIR}/${FEEDSTOCK_NAME}_${ENV_ARTIFACT_PREFIX}_${ARCHIVE_UNIQUE_ID}.zip" - - ( startgroup "Archive conda build environments" ) 2> /dev/null - - # Try 7z and fall back to zip if it fails (for cross-platform use) - if ! 7z a "$ENV_ARTIFACT_PATH" -r "$CONDA_BLD_PATH"/'_*_env*/' -bb; then - pushd "$CONDA_BLD_PATH" - zip -r -y -T "$ENV_ARTIFACT_PATH" . -i '*_*_env*/*' - popd - fi - - ( endgroup "Archive conda build environments" ) 2> /dev/null - - echo "ENV_ARTIFACT_NAME: $ENV_ARTIFACT_NAME" - echo "ENV_ARTIFACT_PATH: $ENV_ARTIFACT_PATH" - - if [[ "$CI" == "azure" ]]; then - echo "##vso[task.setVariable variable=ENV_ARTIFACT_NAME]$ENV_ARTIFACT_NAME" - echo "##vso[task.setVariable variable=ENV_ARTIFACT_PATH]$ENV_ARTIFACT_PATH" - elif [[ "$CI" == "github_actions" ]]; then - echo "ENV_ARTIFACT_NAME=$ENV_ARTIFACT_NAME" >> $GITHUB_OUTPUT - echo "ENV_ARTIFACT_PATH=$ENV_ARTIFACT_PATH" >> $GITHUB_OUTPUT - fi -fi diff --git a/README.md b/README.md index 5566e09c5..1756faa73 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Current release info | Name | Downloads | Version | Platforms | | --- | --- | --- | --- | | [![Conda Recipe](https://img.shields.io/badge/recipe-cpython-green.svg)](https://anaconda.org/conda-forge/cpython) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/cpython.svg)](https://anaconda.org/conda-forge/cpython) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/cpython.svg)](https://anaconda.org/conda-forge/cpython) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/cpython.svg)](https://anaconda.org/conda-forge/cpython) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-libpython-green.svg)](https://anaconda.org/conda-forge/libpython) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libpython.svg)](https://anaconda.org/conda-forge/libpython) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libpython.svg)](https://anaconda.org/conda-forge/libpython) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libpython.svg)](https://anaconda.org/conda-forge/libpython) | | [![Conda Recipe](https://img.shields.io/badge/recipe-libpython--static-green.svg)](https://anaconda.org/conda-forge/libpython-static) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libpython-static.svg)](https://anaconda.org/conda-forge/libpython-static) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libpython-static.svg)](https://anaconda.org/conda-forge/libpython-static) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libpython-static.svg)](https://anaconda.org/conda-forge/libpython-static) | | [![Conda Recipe](https://img.shields.io/badge/recipe-python-green.svg)](https://anaconda.org/conda-forge/python) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/python.svg)](https://anaconda.org/conda-forge/python) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/python.svg)](https://anaconda.org/conda-forge/python) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/python.svg)](https://anaconda.org/conda-forge/python) | | [![Conda Recipe](https://img.shields.io/badge/recipe-python--freethreading-green.svg)](https://anaconda.org/conda-forge/python-freethreading) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/python-freethreading.svg)](https://anaconda.org/conda-forge/python-freethreading) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/python-freethreading.svg)](https://anaconda.org/conda-forge/python-freethreading) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/python-freethreading.svg)](https://anaconda.org/conda-forge/python-freethreading) | @@ -144,10 +145,10 @@ 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 ``` @@ -158,7 +159,7 @@ How to use With conda ``` -conda install cpython libpython-static python python-freethreading python-gil python-jit +conda install cpython libpython libpython-static python python-freethreading python-gil python-jit ``` @@ -167,7 +168,7 @@ conda install cpython libpython-static python python-freethreading python-gil py With mamba ``` -mamba install cpython libpython-static python python-freethreading python-gil python-jit +mamba install cpython libpython libpython-static python python-freethreading python-gil python-jit ``` @@ -177,9 +178,9 @@ mamba install cpython libpython-static python python-freethreading python-gil py ``` # for adding to your local project -pixi add cpython libpython-static python python-freethreading python-gil python-jit +pixi add cpython libpython libpython-static python python-freethreading python-gil python-jit # for installing globally -pixi global install cpython libpython-static python python-freethreading python-gil python-jit +pixi global install cpython libpython libpython-static python python-freethreading python-gil python-jit ``` @@ -193,7 +194,7 @@ It is possible to list all of the versions of `cpython` available on your platfo With conda ``` -conda search cpython --channel conda-forge +conda search cpython --channel conda-forge/label/python_debug ``` @@ -202,7 +203,7 @@ conda search cpython --channel conda-forge With mamba ``` -mamba search cpython --channel conda-forge +mamba search cpython --channel conda-forge/label/python_debug ``` @@ -211,7 +212,7 @@ mamba search cpython --channel conda-forge With pixi ``` -pixi search cpython --channel conda-forge +pixi search cpython --channel conda-forge/label/python_debug ``` @@ -221,13 +222,13 @@ pixi search cpython --channel conda-forge ``` # 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 da8e01140f4d448a751169ea3408e50ade410712 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 14 Aug 2026 09:13:16 +1100 Subject: [PATCH 09/11] add libpython as a run-dep of python --- recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 0c5ec0de6..755ab0023 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -215,6 +215,7 @@ outputs: - _python_rc {% endif %} - python_abi {{ ver2 }}.* *_{{ abi_tag }} + - {{ pin_subpackage('libpython', exact=True) }} test: downstreams: - cython From 18c5ff102c63b0615e4e28a8dcf644e3234036ec Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 14 Aug 2026 20:17:53 +1100 Subject: [PATCH 10/11] remove work-arounds for obsolete CI provider --- recipe/build_base.sh | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/recipe/build_base.sh b/recipe/build_base.sh index e52c83735..d4b7adb05 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -335,29 +335,16 @@ pushd ${_buildd_static} ${_DISABLE_SHARED} "${_PROFILE_TASK[@]}" popd -if [[ "${CI}" == "travis" ]]; then - # Travis has issues with long logs - make -j${CPU_COUNT} -C ${_buildd_static} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ - ${_MAKE_TARGET} "${_PROFILE_TASK[@]}" 2>&1 >make-static.log -else - make -j${CPU_COUNT} -C ${_buildd_static} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ - ${_MAKE_TARGET} "${_PROFILE_TASK[@]}" 2>&1 | tee make-static.log -fi +make -j${CPU_COUNT} -C ${_buildd_static} \ + EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ + ${_MAKE_TARGET} "${_PROFILE_TASK[@]}" 2>&1 | tee make-static.log if rg "Failed to build these modules" make-static.log; then echo "(static) :: Failed to build some modules, check the log" exit 1 fi -if [[ "${CI}" == "travis" ]]; then - # Travis has issues with long logs - make -j${CPU_COUNT} -C ${_buildd_shared} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" 2>&1 >make-shared.log -else - make -j${CPU_COUNT} -C ${_buildd_shared} \ - EXTRA_CFLAGS="${EXTRA_CFLAGS}" 2>&1 | tee make-shared.log -fi +make -j${CPU_COUNT} -C ${_buildd_shared} \ + EXTRA_CFLAGS="${EXTRA_CFLAGS}" 2>&1 | tee make-shared.log if rg "Failed to build these modules" make-shared.log; then echo "(shared) :: Failed to build some modules, check the log" exit 1 From 604a05ad82c9d769e7d97b88153b94145766b6a8 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 14 Aug 2026 20:46:57 +1100 Subject: [PATCH 11/11] reverse build order `python` and `libpython` split existing `build_base.{sh,bat}` into `build.sh`/`bld.bat` and `install_base.{sh,bat}`. --- recipe/bld.bat | 91 +++++++++++ recipe/{build_base.sh => build.sh} | 142 +--------------- recipe/{build_base.bat => install_base.bat} | 40 ----- recipe/install_base.sh | 171 ++++++++++++++++++++ recipe/meta.yaml | 89 +++++----- 5 files changed, 316 insertions(+), 217 deletions(-) create mode 100644 recipe/bld.bat rename recipe/{build_base.sh => build.sh} (68%) rename recipe/{build_base.bat => install_base.bat} (83%) create mode 100644 recipe/install_base.sh diff --git a/recipe/bld.bat b/recipe/bld.bat new file mode 100644 index 000000000..811357c20 --- /dev/null +++ b/recipe/bld.bat @@ -0,0 +1,91 @@ +setlocal EnableDelayedExpansion +echo on + +:: Compile python, extensions and external libraries +if "%target_platform%"=="win-64" ( + set HOST_PLATFORM=x64 + set HOST_DIR=amd64 +) +if "%target_platform%"=="win-32" ( + set HOST_PLATFORM=Win32 + set HOST_DIR=win32 +) +if "%target_platform%"=="win-arm64" ( + set HOST_PLATFORM=ARM64 + set HOST_DIR=arm64 +) + +if "%build_platform%"=="win-64" ( + set BUILD_PLATFORM=x64 + set BUILD_DIR=amd64 +) +if "%build_platform%"=="win-32" ( + set BUILD_PLATFORM=Win32 + set BUILD_DIR=win32 +) +if "%build_platform%"=="win-arm64" ( + set BUILD_PLATFORM=ARM64 + set BUILD_DIR=arm64 +) + +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + set "VERNODOTS=%%i%%j" +) + +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + set "VER=%%i.%%j" +) + +:: Make sure the "python" value in conda_build_config.yaml is up to date. +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + if NOT "%PY_VER%"=="%%i.%%j" exit 1 +) + +for /f "usebackq delims=" %%i in (`conda list -p %PREFIX% sqlite --no-show-channel-urls --json ^| findstr "version"`) do set SQLITE3_VERSION_LINE=%%i +for /f "tokens=2 delims==/ " %%i IN ('echo %SQLITE3_VERSION_LINE%') do (set SQLITE3_VERSION=%%~i) +echo SQLITE3_VERSION detected as %SQLITE3_VERSION% + +if "%PY_INTERP_DEBUG%"=="yes" ( + set CONFIG=-d + set _D=_d +) else ( + set CONFIG= + set _D= +) + +set PGO=--pgo +if "%DEBUG_C%"=="yes" ( + set PGO= +) +if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" ( + set PGO= +) + +if "%PY_FREETHREADING%" == "yes" ( + set "FREETHREADING=--disable-gil" + set "THREAD=t" + set "EXE_T=%VER%t" +) else ( + set "FREETHREADING=--experimental-jit-off" + set "THREAD=" + set "EXE_T=" +) + +cd PCbuild + +setlocal EnableDelayedExpansion +if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" ( + REM build for the build platform. LIBRARY_PREFIX is used by the patches + REM No PGO. No externals, i.e. remove building extension modules + REM we don't need. + set LIBRARY_PREFIX=%BUILD_PREFIX%\\Library + call build.bat %CONFIG% %FREETHREADING% -m -E -v -p %BUILD_PLATFORM% + if errorlevel 1 exit 1 +) +endlocal +:: Twice because: +:: error : importlib_zipimport.h updated. You will need to rebuild pythoncore to see the changes. +call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %HOST_PLATFORM% +call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %HOST_PLATFORM% +if errorlevel 1 exit 1 +cd .. diff --git a/recipe/build_base.sh b/recipe/build.sh similarity index 68% rename from recipe/build_base.sh rename to recipe/build.sh index d4b7adb05..e7e75975e 100644 --- a/recipe/build_base.sh +++ b/recipe/build.sh @@ -152,8 +152,8 @@ if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]]; then CPP="${CC_FOR_BUILD} -E" \ CFLAGS="-O2 -I${BUILD_PREFIX}/include" \ CPPFLAGS="-O2 -I${BUILD_PREFIX}/include" \ - LDFLAGS=${LDFLAGS//${PREFIX}/${BUILD_PREFIX}} \ - PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig \ + LDFLAGS=${LDFLAGS//${PREFIX}/${BUILD_PREFIX}} \ + PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig \ AR="$(${CC_FOR_BUILD} --print-prog-name=ar)" \ RANLIB="$(${CC_FOR_BUILD} --print-prog-name=ranlib)" \ LD="$(${CC_FOR_BUILD} --print-prog-name=ld)" && \ @@ -355,8 +355,6 @@ make -j${CPU_COUNT} -C ${_buildd_shared} \ EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ LIBRARY=libpython${VERABI_NO_DBG}-pic.a libpython${VERABI_NO_DBG}-pic.a -make -C ${_buildd_static} install - declare -a _FLAGS_REPLACE=() if [[ ${_OPTIMIZED} == yes ]]; then _FLAGS_REPLACE+=(-O3) @@ -387,139 +385,3 @@ cat /tmp/Makefile-$$ | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ # Check to see that our differences took. # echo diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VERABI_NO_DBG}/$(basename ${SYSCONFIG}) # diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VERABI_NO_DBG}/$(basename ${SYSCONFIG}) - -# Python installs python${VER}m and python${VER}, one as a hardlink to the other. conda-build breaks these -# by copying. Since the executable may be static it may be very large so change one to be a symlink -# of the other. In this case, python${VER}m will be the symlink. -if [[ -f ${PREFIX}/bin/python${VER}m ]]; then - rm -f ${PREFIX}/bin/python${VER}m - ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python${VER}m -fi -ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python -ln -s ${PREFIX}/bin/pydoc${VER} ${PREFIX}/bin/pydoc -# Workaround for https://github.com/conda/conda/issues/10969 -ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python3.1 - -# Remove test data to save space -# Though keep `support` as some things use that. -# TODO :: Make a subpackage for this once we implement multi-level testing. -pushd ${PREFIX}/lib/python${VERABI_NO_DBG} - mkdir test_keep - mv test/__init__.py test/support test/test_support* test/test_script_helper* test_keep/ - rm -rf test */test - mv test_keep test -popd - -# Size reductions: -pushd ${PREFIX} - if [[ -f lib/libpython${VERABI}.a ]]; then - chmod +w lib/libpython${VERABI}.a - ${STRIP} -S lib/libpython${VERABI}.a - fi - CONFIG_LIBPYTHON=$(find lib/python${VERABI_NO_DBG}/config-${VERABI}* -name "libpython${VERABI}.a") - if [[ -f lib/libpython${VERABI}.a ]] && [[ -f ${CONFIG_LIBPYTHON} ]]; then - chmod +w ${CONFIG_LIBPYTHON} - rm ${CONFIG_LIBPYTHON} - fi -popd - -# Copy sysconfig that gets recorded to a non-default name -# using the new compilers with python will require setting _PYTHON_SYSCONFIGDATA_NAME -# to the name of this file (minus the .py extension) -pushd "${PREFIX}"/lib/python${VERABI_NO_DBG} - # On Python 3.5 _sysconfigdata.py was getting copied in here and compiled for some reason. - # This breaks our attempt to find the right one as recorded_name. - find lib-dynload -name "_sysconfigdata*.py*" -exec rm {} \; - recorded_name=$(find . -name "_sysconfigdata*.py") - our_compilers_name=_sysconfigdata_$(echo ${HOST} | sed -e 's/[.-]/_/g').py - # So we can see if anything has significantly diverged by looking in a built package. - cp ${recorded_name} ${recorded_name}.orig - cp ${recorded_name} sysconfigfile - # fdebug-prefix-map for python work dir is useless for extensions - sed -i.bak "s@-fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/python-$PKG_VERSION@@g" sysconfigfile - sed -i.bak "s@-fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix@@g" sysconfigfile - # Append the conda-forge zoneinfo to the end - sed -i.bak "s@zoneinfo'@zoneinfo:$PREFIX/share/tzinfo'@g" sysconfigfile - # Remove osx sysroot as it depends on the build machine - # be sure CONDA_BUILD_SYSROOT has value, as other we will remove here instead spaces - if [[ "${target_platform}" == osx-* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then - sed -i.bak "s@-isysroot @@g" sysconfigfile - sed -i.bak "s@$CONDA_BUILD_SYSROOT @@g" sysconfigfile - fi - # Remove unfilled config option - sed -i.bak "s/@SGI_ABI@//g" sysconfigfile - sed -i.bak "s@$BUILD_PREFIX/bin/${HOST}-llvm-ar@${HOST}-ar@g" sysconfigfile - # Remove GNULD=yes to make sure new-dtags are not used - sed -i.bak "s/'GNULD': 'yes'/'GNULD': 'no'/g" sysconfigfile - cp sysconfigfile ${our_compilers_name} - - # For system gcc remove the triple - sed -i.bak "s@$HOST-c++@g++@g" sysconfigfile - sed -i.bak "s@$HOST-@@g" sysconfigfile - if [[ "$target_platform" == linux* ]]; then - # For linux, make sure the system gcc uses our linker - sed -i.bak "s@-pthread@-pthread -B $PREFIX/share/python_compiler_compat@g" sysconfigfile - fi - # Don't set -march and -mtune for system gcc - sed -i.bak "s@-march=[^( |\\\"|\\\')]*@@g" sysconfigfile - sed -i.bak "s@-mtune=[^( |\\\"|\\\')]*@@g" sysconfigfile - # Remove these flags that older compilers and linkers may not know - for flag in "-fstack-protector-strong" "-ffunction-sections" "-pipe" "-fno-plt" \ - "-ftree-vectorize" "-Wl,--sort-common" "-Wl,--as-needed" "-Wl,-z,relro" \ - "-Wl,-z,now" "-Wl,--disable-new-dtags" "-Wl,--gc-sections" "-Wl,-O2" \ - "-fPIE" "-ftree-vectorize" "-mssse3" "-Wl,-pie" "-Wl,-dead_strip_dylibs" \ - "-Wl,-headerpad_max_install_names"; do - sed -i.bak "s@$flag@@g" sysconfigfile - done - # Cleanup some extra spaces from above - sed -i.bak "s@' [ ]*@'@g" sysconfigfile - cp sysconfigfile $recorded_name - echo "========================sysconfig===========================" - cat $recorded_name - echo "============================================================" - - rm sysconfigfile - rm sysconfigfile.bak -popd - -if [[ ${HOST} =~ .*linux.* ]]; then - mkdir -p ${PREFIX}/share/python_compiler_compat - ln -s ${PREFIX}/bin/${HOST}-ld ${PREFIX}/share/python_compiler_compat/ld - echo "Files in this folder are to enhance backwards compatibility of anaconda software with older compilers." > ${PREFIX}/share/python_compiler_compat/README - echo "See: https://github.com/conda/conda/issues/6030 for more information." >> ${PREFIX}/share/python_compiler_compat/README -fi - -python -c "import compileall,os;compileall.compile_dir(os.environ['PREFIX'])" -rm ${PREFIX}/lib/libpython${VERABI}.a - -if [[ ${PY_INTERP_DEBUG} == yes ]]; then - rm ${PREFIX}/bin/python${VER} - ln -s ${PREFIX}/bin/python${VERABI} ${PREFIX}/bin/python${VER} - ln -s ${PREFIX}/include/python${VERABI} ${PREFIX}/include/python${VER} -fi - -if [[ "$target_platform" == linux-* ]]; then - rm ${PREFIX}/include/uuid.h -fi - -# Workaround for https://github.com/conda/conda/issues/14053 -# Older conda versions install noarch: python packages in wrong places. -# For example python3.1 because older conda assumed python minor version -# will have only one digit. noarhc pkgs for freethreading builds are supposed -# to be installed into /lib/python3.13t/site-packages, but conda -# installs them to /lib/python3.13/site-packages. -# The workaround is to add all these wrong paths to sys.path using -# a pth file so that cpython and other tools like pip know about these -# locations to check when importing packages and uninstalling packages. -# When installing packages, pip will use the correct location -# /lib/python3.13t/site-packages. -# Note that these directories are not added to sys.path if they do not exist. -SP_DIR="${PREFIX}/lib/python${PY_VER}${THREAD}/site-packages" -if [[ ${PY_FREETHREADING} == yes ]]; then - echo "${PREFIX}/lib/python${PY_VER}/site-packages" >> $SP_DIR/conda-site.pth -fi -# Workaround for https://github.com/conda/conda/issues/10969 -echo "${PREFIX}/lib/python3.1/site-packages" >> $SP_DIR/conda-site.pth -# A python version independent directory that ABI3 and noarch packages can use. -# This is unused at the moment, but keeping it here for experimentation. -echo "${PREFIX}/lib/python/site-packages" >> $SP_DIR/conda-site.pth diff --git a/recipe/build_base.bat b/recipe/install_base.bat similarity index 83% rename from recipe/build_base.bat rename to recipe/install_base.bat index a405f9371..2d7485a2d 100644 --- a/recipe/build_base.bat +++ b/recipe/install_base.bat @@ -36,60 +36,20 @@ for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( set "VER=%%i.%%j" ) -:: Make sure the "python" value in conda_build_config.yaml is up to date. -for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( - if NOT "%PY_VER%"=="%%i.%%j" exit 1 -) - -for /f "usebackq delims=" %%i in (`conda list -p %PREFIX% sqlite --no-show-channel-urls --json ^| findstr "version"`) do set SQLITE3_VERSION_LINE=%%i -for /f "tokens=2 delims==/ " %%i IN ('echo %SQLITE3_VERSION_LINE%') do (set SQLITE3_VERSION=%%~i) -echo SQLITE3_VERSION detected as %SQLITE3_VERSION% - if "%PY_INTERP_DEBUG%"=="yes" ( - set CONFIG=-d set _D=_d ) else ( - set CONFIG= set _D= ) -set PGO=--pgo -if "%DEBUG_C%"=="yes" ( - set PGO= -) -if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" ( - set PGO= -) - if "%PY_FREETHREADING%" == "yes" ( - set "FREETHREADING=--disable-gil" set "THREAD=t" set "EXE_T=%VER%t" ) else ( - set "FREETHREADING=--experimental-jit-off" set "THREAD=" set "EXE_T=" ) -cd PCbuild - -setlocal EnableDelayedExpansion -if "%CONDA_BUILD_CROSS_COMPILATION%" == "1" ( - REM build for the build platform. LIBRARY_PREFIX is used by the patches - REM No PGO. No externals, i.e. remove building extension modules - REM we don't need. - set LIBRARY_PREFIX=%BUILD_PREFIX%\\Library - call build.bat %CONFIG% %FREETHREADING% -m -E -v -p %BUILD_PLATFORM% - if errorlevel 1 exit 1 -) -endlocal -:: Twice because: -:: error : importlib_zipimport.h updated. You will need to rebuild pythoncore to see the changes. -call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %HOST_PLATFORM% -call build.bat %PGO% %CONFIG% %FREETHREADING% -m -e -v -p %HOST_PLATFORM% -if errorlevel 1 exit 1 -cd .. - :: Populate the root package directory for %%x in (python%VERNODOTS%%THREAD%%_D%.dll python3%THREAD%%_D%.dll python%EXE_T%%_D%.exe pythonw%EXE_T%%_D%.exe) do ( if exist %SRC_DIR%\PCbuild\%HOST_DIR%\%%x ( diff --git a/recipe/install_base.sh b/recipe/install_base.sh new file mode 100644 index 000000000..14ea454e6 --- /dev/null +++ b/recipe/install_base.sh @@ -0,0 +1,171 @@ +#!/bin/bash +set -ex + +# Get an updated config.sub and config.guess +cp $BUILD_PREFIX/share/libtool/build-aux/config.* . + +if [[ ! -d ${SRC_DIR}/python-bin ]]; then + # Need an up-to-date python to build python. + # python 3.10 in miniforge is too old. + CONDA_SUBDIR=$build_platform conda create -p ${SRC_DIR}/python-bin python -c conda-forge --override-channels --yes --quiet + export PATH=${SRC_DIR}/python-bin/bin:${PATH} +fi + +VER=${PKG_VERSION%.*} + +_buildd_static=build-static +_buildd_shared=build-shared + +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + DBG=d +else + DBG= +fi + +if [[ ${PY_FREETHREADING} == yes ]]; then + # This Python will not be usable with non-free threading Python modules. + THREAD=t +else + THREAD= +fi + +VERABI=${VER}${THREAD}${DBG} +VERABI_NO_DBG=${VER}${THREAD} + +make -C ${_buildd_static} install + +# Python installs python${VER}m and python${VER}, one as a hardlink to the other. conda-build breaks these +# by copying. Since the executable may be static it may be very large so change one to be a symlink +# of the other. In this case, python${VER}m will be the symlink. +if [[ -f ${PREFIX}/bin/python${VER}m ]]; then + rm -f ${PREFIX}/bin/python${VER}m + ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python${VER}m +fi +ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python +ln -s ${PREFIX}/bin/pydoc${VER} ${PREFIX}/bin/pydoc +# Workaround for https://github.com/conda/conda/issues/10969 +ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python3.1 + +# Remove test data to save space +# Though keep `support` as some things use that. +# TODO :: Make a subpackage for this once we implement multi-level testing. +pushd ${PREFIX}/lib/python${VERABI_NO_DBG} + mkdir test_keep + mv test/__init__.py test/support test/test_support* test/test_script_helper* test_keep/ + rm -rf test */test + mv test_keep test +popd + +# Size reductions: +pushd ${PREFIX} + if [[ -f lib/libpython${VERABI}.a ]]; then + chmod +w lib/libpython${VERABI}.a + ${STRIP} -S lib/libpython${VERABI}.a + fi + CONFIG_LIBPYTHON=$(find lib/python${VERABI_NO_DBG}/config-${VERABI}* -name "libpython${VERABI}.a") + if [[ -f lib/libpython${VERABI}.a ]] && [[ -f ${CONFIG_LIBPYTHON} ]]; then + chmod +w ${CONFIG_LIBPYTHON} + rm ${CONFIG_LIBPYTHON} + fi +popd + +# Copy sysconfig that gets recorded to a non-default name +# using the new compilers with python will require setting _PYTHON_SYSCONFIGDATA_NAME +# to the name of this file (minus the .py extension) +pushd "${PREFIX}"/lib/python${VERABI_NO_DBG} + # On Python 3.5 _sysconfigdata.py was getting copied in here and compiled for some reason. + # This breaks our attempt to find the right one as recorded_name. + find lib-dynload -name "_sysconfigdata*.py*" -exec rm {} \; + recorded_name=$(find . -name "_sysconfigdata*.py") + our_compilers_name=_sysconfigdata_$(echo ${HOST} | sed -e 's/[.-]/_/g').py + # So we can see if anything has significantly diverged by looking in a built package. + cp ${recorded_name} ${recorded_name}.orig + cp ${recorded_name} sysconfigfile + # fdebug-prefix-map for python work dir is useless for extensions + sed -i.bak "s@-fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/python-$PKG_VERSION@@g" sysconfigfile + sed -i.bak "s@-fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix@@g" sysconfigfile + # Append the conda-forge zoneinfo to the end + sed -i.bak "s@zoneinfo'@zoneinfo:$PREFIX/share/tzinfo'@g" sysconfigfile + # Remove osx sysroot as it depends on the build machine + # be sure CONDA_BUILD_SYSROOT has value, as other we will remove here instead spaces + if [[ "${target_platform}" == osx-* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then + sed -i.bak "s@-isysroot @@g" sysconfigfile + sed -i.bak "s@$CONDA_BUILD_SYSROOT @@g" sysconfigfile + fi + # Remove unfilled config option + sed -i.bak "s/@SGI_ABI@//g" sysconfigfile + sed -i.bak "s@$BUILD_PREFIX/bin/${HOST}-llvm-ar@${HOST}-ar@g" sysconfigfile + # Remove GNULD=yes to make sure new-dtags are not used + sed -i.bak "s/'GNULD': 'yes'/'GNULD': 'no'/g" sysconfigfile + cp sysconfigfile ${our_compilers_name} + + # For system gcc remove the triple + sed -i.bak "s@$HOST-c++@g++@g" sysconfigfile + sed -i.bak "s@$HOST-@@g" sysconfigfile + if [[ "$target_platform" == linux* ]]; then + # For linux, make sure the system gcc uses our linker + sed -i.bak "s@-pthread@-pthread -B $PREFIX/share/python_compiler_compat@g" sysconfigfile + fi + # Don't set -march and -mtune for system gcc + sed -i.bak "s@-march=[^( |\\\"|\\\')]*@@g" sysconfigfile + sed -i.bak "s@-mtune=[^( |\\\"|\\\')]*@@g" sysconfigfile + # Remove these flags that older compilers and linkers may not know + for flag in "-fstack-protector-strong" "-ffunction-sections" "-pipe" "-fno-plt" \ + "-ftree-vectorize" "-Wl,--sort-common" "-Wl,--as-needed" "-Wl,-z,relro" \ + "-Wl,-z,now" "-Wl,--disable-new-dtags" "-Wl,--gc-sections" "-Wl,-O2" \ + "-fPIE" "-ftree-vectorize" "-mssse3" "-Wl,-pie" "-Wl,-dead_strip_dylibs" \ + "-Wl,-headerpad_max_install_names"; do + sed -i.bak "s@$flag@@g" sysconfigfile + done + # Cleanup some extra spaces from above + sed -i.bak "s@' [ ]*@'@g" sysconfigfile + cp sysconfigfile $recorded_name + echo "========================sysconfig===========================" + cat $recorded_name + echo "============================================================" + + rm sysconfigfile + rm sysconfigfile.bak +popd + +if [[ ${HOST} =~ .*linux.* ]]; then + mkdir -p ${PREFIX}/share/python_compiler_compat + ln -s ${PREFIX}/bin/${HOST}-ld ${PREFIX}/share/python_compiler_compat/ld + echo "Files in this folder are to enhance backwards compatibility of anaconda software with older compilers." > ${PREFIX}/share/python_compiler_compat/README + echo "See: https://github.com/conda/conda/issues/6030 for more information." >> ${PREFIX}/share/python_compiler_compat/README +fi + +python -c "import compileall,os;compileall.compile_dir(os.environ['PREFIX'])" +rm ${PREFIX}/lib/libpython${VERABI}.a + +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + rm ${PREFIX}/bin/python${VER} + ln -s ${PREFIX}/bin/python${VERABI} ${PREFIX}/bin/python${VER} + ln -s ${PREFIX}/include/python${VERABI} ${PREFIX}/include/python${VER} +fi + +if [[ "$target_platform" == linux-* ]]; then + rm ${PREFIX}/include/uuid.h +fi + +# Workaround for https://github.com/conda/conda/issues/14053 +# Older conda versions install noarch: python packages in wrong places. +# For example python3.1 because older conda assumed python minor version +# will have only one digit. noarhc pkgs for freethreading builds are supposed +# to be installed into /lib/python3.13t/site-packages, but conda +# installs them to /lib/python3.13/site-packages. +# The workaround is to add all these wrong paths to sys.path using +# a pth file so that cpython and other tools like pip know about these +# locations to check when importing packages and uninstalling packages. +# When installing packages, pip will use the correct location +# /lib/python3.13t/site-packages. +# Note that these directories are not added to sys.path if they do not exist. +SP_DIR="${PREFIX}/lib/python${PY_VER}${THREAD}/site-packages" +if [[ ${PY_FREETHREADING} == yes ]]; then + echo "${PREFIX}/lib/python${PY_VER}/site-packages" >> $SP_DIR/conda-site.pth +fi +# Workaround for https://github.com/conda/conda/issues/10969 +echo "${PREFIX}/lib/python3.1/site-packages" >> $SP_DIR/conda-site.pth +# A python version independent directory that ABI3 and noarch packages can use. +# This is unused at the moment, but keeping it here for experimentation. +echo "${PREFIX}/lib/python/site-packages" >> $SP_DIR/conda-site.pth diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 755ab0023..8dce8001c 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -99,14 +99,57 @@ build: requirements: build: - - patch # [not win] - - m2-patch # [win] - - m2-gcc-libs # [win] + - {{ stdlib('c') }} + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - libtool # [unix] + - make # [unix] + - pkg-config # [unix] + - ld_impl_{{ target_platform }} # [linux] + - binutils_impl_{{ target_platform }} # [linux] + - clang-19 # [unix] + - clang 19.* # [win] + # configure script looks for llvm-ar for lto + - llvm-tools # [osx] + - llvm-tools-19 # [unix] + - llvm-tools 19.* # [win] + - bzip2 # [build_platform != target_platform] + - expat # [build_platform != target_platform] + - libffi # [build_platform != target_platform] + - liblzma-devel # [build_platform != target_platform] + - libmpdec-devel # [build_platform != target_platform] + - libsqlite # [build_platform != target_platform] + - libuuid # [build_platform != target_platform and linux] + - libxcrypt # [build_platform != target_platform and linux] + - ncurses # [build_platform != target_platform and unix] + - openssl # [build_platform != target_platform] + - readline # [build_platform != target_platform and unix] + - tk # [build_platform != target_platform] + - zlib # [build_platform != target_platform] + - zstd # [build_platform != target_platform] + host: + - ld_impl_{{ target_platform }} >=2.36 # [linux] + - bzip2 + - expat + - libffi + - liblzma-devel + - libmpdec-devel + - libsqlite + - libuuid # [linux] + - ncurses # [unix] + - openssl + - readline # [unix] + - tk + # These two are just to get the headers needed for tk.h, but is unused + - xorg-libx11 # [unix] + - xorg-xorgproto # [unix] + - zlib + - zstd outputs: - name: python - script: build_base.sh # [unix] - script: build_base.bat # [win] + script: install_base.sh # [unix] + script: install_base.bat # [win] build: number: {{ build_number }} activate_in_script: true @@ -162,35 +205,11 @@ outputs: - '**/api-ms-win-core-path-l1-1-0.dll' # [win] requirements: build: - - {{ compiler('c') }} - {{ stdlib('c') }} + - {{ compiler('c') }} - {{ compiler('cxx') }} - - make # [not win] - - libtool # [unix] - - pkg-config # [not win] - # configure script looks for llvm-ar for lto - - llvm-tools # [osx] - - ld_impl_{{ target_platform }} # [linux] - - binutils_impl_{{ target_platform }} # [linux] - - clang-19 # [not win] - - llvm-tools-19 # [not win] - - clang 19.* # [win] - - llvm-tools 19.* # [win] - - bzip2 # [build_platform != target_platform] - - libsqlite # [build_platform != target_platform] - - liblzma-devel # [build_platform != target_platform] - - zlib # [build_platform != target_platform] - - zstd # [build_platform != target_platform] - - openssl # [build_platform != target_platform] - - readline # [not win and build_platform != target_platform] - - tk # [build_platform != target_platform] - - ncurses # [unix and build_platform != target_platform] - - libffi # [build_platform != target_platform] - - libuuid # [linux and build_platform != target_platform] - - libxcrypt # [linux and build_platform != target_platform] - - libmpdec-devel # [build_platform != target_platform] - - expat # [build_platform != target_platform] host: + - {{ pin_subpackage('libpython', exact=True) }} - bzip2 - libsqlite - liblzma-devel @@ -209,13 +228,13 @@ outputs: - libmpdec-devel - expat run: + - {{ pin_subpackage('libpython', exact=True) }} - ld_impl_{{ target_platform }} >=2.36.1 # [linux] - tzdata {% if dev != '' %} - _python_rc {% endif %} - python_abi {{ ver2 }}.* *_{{ abi_tag }} - - {{ pin_subpackage('libpython', exact=True) }} test: downstreams: - cython @@ -308,13 +327,9 @@ outputs: string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} requirements: build: - - {{ compiler('c') }} - {{ stdlib('c') }} + - {{ compiler('c') }} - {{ compiler('cxx') }} - host: - - {{ pin_subpackage('python', exact=True) }} - run: - - {{ pin_subpackage('python', exact=True) }} test: files: - tests/cmake/*