diff --git a/abs.yaml b/abs.yaml index 31c3d0cb..e9534a31 100644 --- a/abs.yaml +++ b/abs.yaml @@ -5,6 +5,7 @@ build_parameters: - "--error-overlinking" - "--error-overdepending" -# Upload all testing artifacts on a labeled testing channel: ad-testing/label/py315 -upload_channels: -- ad-testing/label/py315 +# Destination: pkgs/main (PBP default). Do not set upload_channels or labeled +# testing channels — this branch delivers CF-align freethreading/debug for main. +build_env_vars: + ANACONDA_ROCKET_ENABLE_PY315: yes diff --git a/recipe/build_base.bat b/recipe/build_base.bat index ab662319..4f7980eb 100644 --- a/recipe/build_base.bat +++ b/recipe/build_base.bat @@ -52,7 +52,7 @@ if "%DEBUG_C%"=="yes" ( set PGO=--pgo ) -if "%PY_GIL_DISABLED%" == "yes" ( +if "%PY_FREETHREADING%" == "yes" ( set "FREETHREADING=--disable-gil" set "THREAD=t" set "EXE_T=%VER%t" diff --git a/recipe/build_base.sh b/recipe/build_base.sh index f471027b..af1e1de3 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -35,30 +35,16 @@ _buildd_shared=build-shared _ENABLE_SHARED=--enable-shared # We *still* build a shared lib here for non-static embedded use cases _DISABLE_SHARED=--disable-shared -# Hack to allow easily comparing static vs shared interpreter performance -# .. hack because we just build it shared in both the build-static and -# build-shared directories. -# Yes this hack is a bit confusing, sorry about that. -if [[ ${PY_INTERP_LINKAGE_NATURE} == shared ]]; then - _DISABLE_SHARED=--enable-shared - _ENABLE_SHARED=--enable-shared -fi # For debugging builds, set this to no to disable profile-guided optimization -if [[ ${DEBUG_C} == yes ]]; then +if [[ ${PY_INTERP_DEBUG} == yes ]]; then _OPTIMIZED=no else _OPTIMIZED=yes fi -if [[ ${target_platform} == linux-ppc64le ]]; then - _OPTIMIZED=no - # ppc64le cdt need to be rebuilt with files in powerpc64le-conda-linux-gnu instead of powerpc64le-conda_cos7-linux-gnu. In the mean time: - cp --force --archive --update --link $BUILD_PREFIX/powerpc64le-conda_cos7-linux-gnu/. $BUILD_PREFIX/powerpc64le-conda-linux-gnu -fi - declare -a _dbg_opts -if [[ ${DEBUG_PY} == yes ]]; then +if [[ ${PY_INTERP_DEBUG} == yes ]]; then # This Python will not be usable with non-debug Python modules. _dbg_opts+=(--with-pydebug) DBG=d @@ -66,15 +52,16 @@ else DBG= fi -if [[ ${PY_GIL_DISABLED} == yes ]]; then +if [[ ${PY_FREETHREADING} == yes ]]; then # This Python will not be usable with non-free threading Python modules. THREAD=t else THREAD= fi -ABIFLAGS=${DBG} +ABIFLAGS=${DBG}${THREAD} VERABI=${VER}${THREAD}${DBG} +VERABI_NO_DBG=${VER}${THREAD} # Make sure the "python" value in conda_build_config.yaml is up to date. test "${PY_VER}" = "${VER}" @@ -85,7 +72,7 @@ test "${PY_VER}" = "${VER}" unset _PYTHON_SYSCONFIGDATA_NAME unset _CONDA_PYTHON_SYSCONFIGDATA_NAME -# Prevent lib/python${VERABI}/_sysconfigdata_*.py from ending up with full paths to these things +# Prevent lib/python${VERABI_NO_DBG}/_sysconfigdata_*.py from ending up with full paths to these things # in _build_env because _build_env will not get found during prefix replacement, only _h_env_placeh ... AR=$(basename "${AR}") @@ -113,6 +100,12 @@ if [[ ${_OPTIMIZED} = yes ]]; then CXXFLAGS=$(echo "${CXXFLAGS}" | sed "s/-O2/-O3/g") fi +if [[ ${PY_INTERP_DEBUG} == yes ]]; then + CPPFLAGS=$(echo "${CPPFLAGS}" | sed "s/-O2/-O0/g") + CFLAGS=$(echo "${CFLAGS}" | sed "s/-O2/-O0/g") + CXXFLAGS=$(echo "${CXXFLAGS}" | sed "s/-O2/-O0/g") +fi + if [[ "$target_platform" == linux-* ]]; then cp ${PREFIX}/include/uuid/uuid.h ${PREFIX}/include/uuid.h fi @@ -209,7 +202,7 @@ if [[ ${target_platform} == osx-64 ]]; then # TODO: check with LLVM 12 if the following hack is needed. # https://reviews.llvm.org/D76461 may have fixed the need for the following hack. echo '#!/bin/bash' > $BUILD_PREFIX/bin/$HOST-llvm-ar - echo "$BUILD_PREFIX/bin/llvm-ar --format=darwin" '"$@"' >> $BUILD_PREFIX/bin/$HOST-llvm-ar + echo "$BUILD_PREFIX/bin/llvm-ar-21 --format=darwin" '"$@"' >> $BUILD_PREFIX/bin/$HOST-llvm-ar chmod +x $BUILD_PREFIX/bin/$HOST-llvm-ar export ARCHFLAGS="-arch x86_64" elif [[ ${target_platform} == osx-arm64 ]]; then @@ -218,7 +211,7 @@ elif [[ ${target_platform} == osx-arm64 ]]; then export ac_sys_release=20.0.0 export MACOSX_DEFAULT_ARCH=arm64 echo '#!/bin/bash' > $BUILD_PREFIX/bin/$HOST-llvm-ar - echo "$BUILD_PREFIX/bin/llvm-ar --format=darwin" '"$@"' >> $BUILD_PREFIX/bin/$HOST-llvm-ar + echo "$BUILD_PREFIX/bin/llvm-ar-21 --format=darwin" '"$@"' >> $BUILD_PREFIX/bin/$HOST-llvm-ar chmod +x $BUILD_PREFIX/bin/$HOST-llvm-ar export ARCHFLAGS="-arch arm64" export CFLAGS="$CFLAGS $ARCHFLAGS" @@ -260,7 +253,7 @@ _common_configure_args+=("--with-tcltk-libs=-L${PREFIX}/lib -ltcl${TCLTK_VER} -l _common_configure_args+=(--with-platlibdir=lib) _common_configure_args+=(--with-system-libmpdec=yes) -if [[ "${DEBUG_PY}" == "yes" || "${target_platform}" != *"64" || ${PY_GIL_DISABLED} == yes ]]; then +if [[ "${PY_INTERP_DEBUG}" == "yes" || "${target_platform}" != *"-64" || ${PY_FREETHREADING} == yes ]]; then _common_configure_args+=(--enable-experimental-jit=no) else _common_configure_args+=(--enable-experimental-jit=yes-off) @@ -271,7 +264,7 @@ if [[ "${target_platform}" == osx-* ]]; then _common_configure_args+=(--with-tail-call-interp) fi -if [[ ${PY_GIL_DISABLED} == yes ]]; then +if [[ ${PY_FREETHREADING} == yes ]]; then _common_configure_args+=(--disable-gil) fi @@ -367,7 +360,7 @@ fi # build a static library with PIC objects and without LTO/PGO make -j${CPU_COUNT} -C ${_buildd_shared} \ EXTRA_CFLAGS="${EXTRA_CFLAGS}" \ - LIBRARY=libpython${VERABI}-pic.a libpython${VERABI}-pic.a + LIBRARY=libpython${VERABI_NO_DBG}-pic.a libpython${VERABI_NO_DBG}-pic.a make -C ${_buildd_static} install @@ -399,15 +392,17 @@ fi SYSCONFIG=$(find ${_buildd_static}/$(cat ${_buildd_static}/pybuilddir.txt) -name "_sysconfigdata*.py" -print0) cat ${SYSCONFIG} | ${SYS_PYTHON} "${RECIPE_DIR}"/replace-word-pairs.py \ "${_FLAGS_REPLACE[@]}" \ - > ${PREFIX}/lib/python${VERABI}/$(basename ${SYSCONFIG}) -MAKEFILE=$(find ${PREFIX}/lib/python${VERABI}/ -path "*config-*/Makefile" -print0) + > ${PREFIX}/lib/python${VERABI_NO_DBG}/$(basename ${SYSCONFIG}) +BUILD_DETAILS=${_buildd_shared}/$(cat ${_buildd_shared}/pybuilddir.txt)/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 \ "${_FLAGS_REPLACE[@]}" \ > ${MAKEFILE} # Check to see that our differences took. -# echo diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VERABI}/$(basename ${SYSCONFIG}) -# diff -urN ${SYSCONFIG} ${PREFIX}/lib/python${VERABI}/$(basename ${SYSCONFIG}) +# 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 @@ -427,7 +422,7 @@ 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} +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 @@ -440,33 +435,17 @@ pushd ${PREFIX} chmod +w lib/libpython${VERABI}.a ${STRIP} -S lib/libpython${VERABI}.a fi - CONFIG_LIBPYTHON=$(find lib/python${VERABI}/config-${VERABI}* -name "libpython${VERABI}.a") + 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 -# OLD_HOST is with CentOS version in them. When building this recipe -# with the compilers from conda-forge OLD_HOST != HOST, but when building -# with the compilers from defaults OLD_HOST == HOST. Both cases are handled in the -# code below -case "$target_platform" in - linux-64) - OLD_HOST=$(echo ${HOST} | sed -e 's/-conda-/-conda_cos6-/g') - ;; - linux-*) - OLD_HOST=$(echo ${HOST} | sed -e 's/-conda-/-conda_cos7-/g') - ;; - *) - OLD_HOST=$HOST - ;; -esac - # 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} +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 {} \; @@ -481,9 +460,9 @@ pushd "${PREFIX}"/lib/python${VERABI} # 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 - sed -i.bak "s@-isysroot @@g" sysconfigfile - # make sure $CONDA_BUILD_SYSROOT is not empty ... - if [[ ${HOST} =~ .*darwin.* ]] && [[ -n ${CONDA_BUILD_SYSROOT} ]]; then + # 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 @@ -493,16 +472,12 @@ pushd "${PREFIX}"/lib/python${VERABI} sed -i.bak "s/'GNULD': 'yes'/'GNULD': 'no'/g" sysconfigfile cp sysconfigfile ${our_compilers_name} - sed -i.bak "s@${HOST}@${OLD_HOST}@g" sysconfigfile - old_compiler_name=_sysconfigdata_$(echo ${OLD_HOST} | sed -e 's/[.-]/_/g').py - cp sysconfigfile ${old_compiler_name} - # For system gcc remove the triple - sed -i.bak "s@$OLD_HOST-c++@g++@g" sysconfigfile - sed -i.bak "s@$OLD_HOST-@@g" sysconfigfile + 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/compiler_compat@g" sysconfigfile + 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 @@ -527,14 +502,22 @@ pushd "${PREFIX}"/lib/python${VERABI} popd if [[ ${HOST} =~ .*linux.* ]]; then - mkdir -p ${PREFIX}/compiler_compat - ln -s ${PREFIX}/bin/${HOST}-ld ${PREFIX}/compiler_compat/ld - echo "Files in this folder are to enhance backwards compatibility of anaconda software with older compilers." > ${PREFIX}/compiler_compat/README - echo "See: https://github.com/conda/conda/issues/6030 for more information." >> ${PREFIX}/compiler_compat/README + 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}/lib/libpython${VERABI}${SHLIB_EXT} ${PREFIX}/lib/libpython${VERABI_NO_DBG}${SHLIB_EXT} + ln -s ${PREFIX}/include/python${VERABI} ${PREFIX}/include/python${VER} +fi + if [[ "$target_platform" == linux-* ]]; then rm ${PREFIX}/include/uuid.h fi @@ -552,7 +535,7 @@ fi # /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_GIL_DISABLED} == yes ]]; then +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 diff --git a/recipe/build_static.sh b/recipe/build_static.sh index 9b5f3908..f7724373 100644 --- a/recipe/build_static.sh +++ b/recipe/build_static.sh @@ -1,46 +1,33 @@ #!/bin/bash set -ex -cd ${SRC_DIR} - _buildd_static=build-static _buildd_shared=build-shared -if [[ ${DEBUG_PY} == yes ]]; then +if [[ ${PY_INTERP_DEBUG} == yes ]]; then DBG=d else DBG= fi -if [[ ${PY_GIL_DISABLED} == yes ]]; then +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%.*} -VERABI=${VER}${DBG}${THREAD} -case "$target_platform" in - linux-64) - OLD_HOST=$(echo ${HOST} | sed -e 's/-conda_cos6//g') - OLD_HOST=$(echo ${OLD_HOST} | sed -e 's/-conda_cos7//g') - OLD_HOST=$(echo ${OLD_HOST} | sed -e 's/-conda//g') - ;; - linux-*) - OLD_HOST=$(echo ${HOST} | sed -e 's/-conda_cos7//g') - OLD_HOST=$(echo ${OLD_HOST} | sed -e 's/-conda//g') - ;; - *) - OLD_HOST=$HOST - ;; -esac +VER=${PKG_VERSION%.*} +ABIFLAGS=${DBG}${THREAD} +VERABI=${VER}${THREAD}${DBG} +VERABI_NO_DBG=${VER}${THREAD} cp -pf ${_buildd_static}/libpython${VERABI}.a ${PREFIX}/lib/libpython${VERABI}.a if [[ ${HOST} =~ .*linux.* ]]; then - pushd ${PREFIX}/lib/python${VERABI}/config-${VERABI}-${OLD_HOST} + pushd ${PREFIX}/lib/python${VERABI_NO_DBG}/config-${VERABI}-${HOST/-conda/} elif [[ ${HOST} =~ .*darwin.* ]]; then - pushd ${PREFIX}/lib/python${VERABI}/config-${VERABI}-darwin + pushd ${PREFIX}/lib/python${VERABI_NO_DBG}/config-${VERABI}-darwin fi ln -s ../../libpython${VERABI}.a libpython${VERABI}.a popd # If the LTO info in the normal lib is problematic (using different compilers for example # we also provide a 'nolto' version). -cp -pf ${_buildd_shared}/libpython${VERABI}-pic.a ${PREFIX}/lib/libpython${VERABI}.nolto.a +cp -pf ${_buildd_shared}/libpython${VERABI_NO_DBG}-pic.a ${PREFIX}/lib/libpython${VERABI_NO_DBG}.nolto.a diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index dffd4121..8270fb96 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -7,10 +7,20 @@ numpy: # Override aggregate global tk 8.6 — build/test against tk 9 from pkgs/main tk: - '9.0' -gil_type: - - normal - # Will be enabled as part of https://anaconda.atlassian.net/browse/PKG-5855 - - disabled +# Override aggregate global clang 20 on osx. CPython 3.15 JIT requires LLVM 21 +# (Tools/jit/_llvm.py); mixing compiler('c')=20 with clang-21/llvm-tools-21 +# breaks osx-arm64 LTO+PGO (___llvm_profile_runtime) and JIT tool discovery. +# Matches conda-forge python-feedstock osx c_compiler_version: 21. +c_compiler_version: # [osx] + - 21 # [osx] +cxx_compiler_version: # [osx] + - 21 # [osx] +freethreading: + - yes + - no # [not (s390x or (osx and x86_64))] +build_type: + - release + - debug # [not win] # TODO: Windows tail-calling interpreter: 64-bit builds with Visual Studio 2026 (MSVC 18) can now use the tail-call interpreter (reported ~15–20% speedup). # Official python.org Windows binaries now use it. diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e1620e15..6475daa9 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set version = "3.15.0" %} -{% set dev = "b4" %} +{% set dev = "rc1" %} {% set dev_ = "" %} {% set ver2 = '.'.join(version.split('.')[0:2]) %} {% set ver2nd = ''.join(version.split('.')[0:2]) %} @@ -14,55 +14,24 @@ # Sanitize build system env. var tweak parameters # (passed to the build scripts via script_env). -{% set from_source_control = os.environ.get('CONDA_BUILD_FROM_SOURCE_CONTROL', '') %} -{% if from_source_control == '' or from_source_control == 'no' %} - {% set from_source_control = 'no' %} -{% else %} - {% set from_source_control = 'yes' %} -{% endif %} -{% set linkage_nature = os.environ.get('PY_INTERP_LINKAGE_NATURE', '') %} -{% if linkage_nature != '' %} - {% set linkage_nature = "_" ~ linkage_nature %} -{% endif %} -{% if linkage_nature == 'shared' %} - {% set linkage_nature_env = 'shared' %} -{% else %} - {% set linkage_nature_env = 'static' %} -{% endif %} -{% set dbg_abi = "" %} -{% set debug = os.environ.get('PY_INTERP_DEBUG', '') %} -{% if debug != '' and debug != 'no' %} - {% set py_interp_debug = "yes" %} - {% set debug = "_dbg" %} - {% set dbg_abi = "d" %} # [win] -{% else %} - {% set py_interp_debug = "no" %} -{% endif %} - -# no-GIL, set using conda_build_config.yaml -{% if gil_type is defined and gil_type == "disabled" %} - {% set py_gil_disabled = "yes" %} - {% set abi_suffix = "t" %} -{% else %} - {% set py_gil_disabled = "no" %} - {% set abi_suffix = "" %} - {% set build_number = build_number + 100 %} -{% endif %} -{% set abi_tag = "cp" + ver2nd + abi_suffix %} +# Intentional AR divergence from conda-forge: drop PY_INTERP_LINKAGE_NATURE / +# from_source_control os.environ Jinja in favor of CBC freethreading + build_type. +# Empty linkage_nature (no _shared/_static in build string) matches current AR py315. +{% set abi_tag = "cp" + ver2nd + ("t" if freethreading == "yes" else "") %} +{% set build_number = build_number + (0 if freethreading == "yes" else 100) %} +{% set py_interp_debug = "yes" if build_type == "debug" else "no" %} +{% set debug = "_debug" if build_type == "debug" else "" %} +{% set site_packages_path_unix = ("lib/python" + ver2 + "t/site-packages" if freethreading == "yes" else "lib/python" + ver2 + "/site-packages") %} +{% set site_packages_path = "Lib/site-packages" if win else site_packages_path_unix %} package: name: python-split version: {{ version }}{{ dev }} source: -{% if from_source_control == 'yes' %} - - git_url: https://github.com/python/CPython.git - git_tag: v{{ version }}{{ dev }} -{% else %} - url: https://www.python.org/ftp/python/{{ version }}/Python-{{ version }}{{ dev }}.tar.xz # md5 from: https://www.python.org/downloads/release/python-{{ ver3nd }}/ - sha256: 93efb9c88d7b6633368e7f7b8f8db6e98988f7f761c09b77849447262841ce3a -{% endif %} + sha256: f84dad680ab2147417d2739355c2678f0f9acffe4ae8ef77895de1454b384b07 patches: - patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch - patches/0002-Win32-Do-not-download-externals.patch @@ -93,18 +62,14 @@ source: - patches/0023-branding.patch - patches/0024-Unvendor-zlib-ng.patch - patches/0025-Unvendor-zstd.patch - - patches/0026-xxlimited-freethreading-stable-abi-link.patch # [win] + - patches/0026-xxlimited-freethreading-stable-abi-link.patch # [win and freethreading == "yes"] build: number: {{ build_number }} requirements: build: -{% if from_source_control == 'yes' %} - - git -{% else %} - msys2-gcc-libs # [win] -{% endif %} outputs: - name: python @@ -134,32 +99,23 @@ outputs: # - lib/libpython3.so # [linux] # - lib/python{{ ver2 }}/lib-dynload/_hashlib.cpython-{{ ver2nd }}-x86_64-linux-gnu.so # [linux] # - lib/libpython3.dylib # [osx] - # match python.org compiler standard - skip: true # [win and int(float(vc)) < 14] -{% if 'conda-forge' in channel_targets %} + # match python.org compiler standard (vc14+ only for 3.15) + skip: true # [win and vc < 14] skip_compile_pyc: - - '*.py' # [build_platform != target_platform] -{% endif %} - string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_{{ abi_tag }} - track_features: # [gil_type == "disabled"] - - free-threading # [gil_type == "disabled"] + - '*.py' # [build_platform != target_platform] + string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} + python_site_packages_path: {{ site_packages_path }} + track_features: # [freethreading == "yes"] + - py_freethreading # [freethreading == "yes"] run_exports: noarch: - python weak: - python_abi {{ ver2 }}.* *_{{ abi_tag }} + - python {{ ver2 }}.* *_debug_{{ abi_tag }} # [build_type == "debug"] script_env: - - PY_INTERP_LINKAGE_NATURE={{ linkage_nature_env }} - PY_INTERP_DEBUG={{ py_interp_debug }} - - PY_GIL_DISABLED={{ py_gil_disabled }} - # Putting these here means they get emitted to build_env_setup.{sh,bat} meaning we can launch IDEs - # after sourcing or calling that script without examine the contents of conda_build.{sh,bat} for - # important env. vars. -{% if 'conda-forge' in channel_targets %} - - CONDA_FORGE=yes -{% else %} - - CONDA_FORGE=no -{% endif %} + - PY_FREETHREADING={{ freethreading }} missing_dso_whitelist: # [win or linux] - '**/MSVCR71.dll' # [win] - '**/MSVCR80.dll' # [win] @@ -184,16 +140,14 @@ outputs: - 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] # called in build_base.sh - ripgrep # [not win] -{% if 'conda-forge' in channel_targets %} - binutils_impl_{{ target_platform }} # [linux] -{% endif %} # https://github.com/python/cpython/blob/main/Tools/jit/README.md#installing-llvm: # "LLVM version 21 is the officially supported version" + # Also supplies llvm-ar-21, which build_base.sh wraps as the lto archiver + # that configure picks up via $HOST-llvm-ar. - clang-21 # [not win] - llvm-tools-21 # [not win] - clang 21.* # [win] @@ -223,22 +177,12 @@ outputs: - python_abi * *_{{ abi_tag }} - ld_impl_{{ target_platform }} >=2.35.1 # [linux] - tzdata -{% if 'conda-forge' in channel_targets %} - - ncurses # [unix] - run_constrained: - - python_abi {{ ver2 }}.* *_cp{{ ver2nd }} -{% endif %} test: -{% if 'conda-forge' in channel_targets %} - downstreams: - - cython - - setuptools -{% endif %} requires: - ripgrep - cmake-no-system - make # [unix] - - ninja-base + - ninja - {{ stdlib('c') }} - {{ compiler('c') }} # Tried to use enable_language(C) to avoid needing this. It does not work. @@ -282,22 +226,18 @@ outputs: - if not exist %PREFIX%\\Scripts\\idle.exe exit 1 # [win] - if not exist %PREFIX%\\Scripts\\pydoc.exe exit 1 # [win] - if not exist %PREFIX%\\include\\pyconfig.h exit 1 # [win] - - if not exist %PREFIX%\\libs\\python{{ ver2nd }}{{ abi_suffix }}.lib exit 1 # [win] + - if not exist %PREFIX%\\libs\\python3t.lib exit 1 # [win and freethreading == "yes"] + - if not exist %PREFIX%\\libs\\python{{ ver2nd }}t.lib exit 1 # [win and freethreading == "yes"] + - if not exist %PREFIX%\\libs\\python3.lib exit 1 # [win and freethreading == "no"] + - if not exist %PREFIX%\\libs\\python{{ ver2nd }}.lib exit 1 # [win and freethreading == "no"] - pushd tests - pushd prefix-replacement # [unix] - bash build-and-test.sh # [unix] - popd # [unix] - pushd cmake -{% if gil_type is defined and gil_type == "disabled" %} - # TODO: cmake does not know about the free-threading ABI and fails to - # identify libpython3.13t.dylib as a valid PythonLibs target. - # Skip this test for the time being. - # https://gitlab.kitware.com/cmake/cmake/-/issues/26016 - - cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . || true # [unix] - - cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . || type nul>nul # [win] -{% else %} - - cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . -{% endif %} + # FindPythonLibs does not know freethreading/debug ABIs; skip those variants. + # TODO: use FindPython3 once it supports freethreading (cmake#26016). + - cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . # [freethreading == "no" and build_type != "debug"] - popd - popd - python run_test.py @@ -307,28 +247,26 @@ outputs: # Test for segfault on osx-64 with libffi=3.4, see https://bugs.python.org/issue44556 - python -c "from ctypes import CFUNCTYPE; CFUNCTYPE(None)(id)" -{% if bootstrap != "true" %} - name: libpython-static script: build_static.sh # [unix] script: build_static.bat # [win] build: number: {{ build_number }} force_use_keys: - - gil_type + - freethreading + - build_type activate_in_script: true ignore_run_exports: - python_abi - string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_{{ abi_tag }} + string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} script_env: - - PY_GIL_DISABLED={{ py_gil_disabled }} + - PY_INTERP_DEBUG={{ py_interp_debug }} + - PY_FREETHREADING={{ freethreading }} requirements: build: - {{ stdlib('c') }} - {{ compiler('c') }} - {{ compiler('cxx') }} -{% if from_source_control == 'yes' %} - - git -{% endif %} host: - {{ pin_subpackage('python', exact=True) }} run: @@ -344,22 +282,22 @@ outputs: - ripgrep commands: - - pushd tests # [unix] - - pushd prefix-replacement # [unix] - - test -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}{{ abi_suffix }}.a # [unix] - - test -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}{{ abi_suffix }}.nolto.a # [unix] - - test -f ${PREFIX}/lib/python${PKG_VERSION%.*}{{ abi_suffix }}/config-${PKG_VERSION%.*}{{ abi_suffix }}-darwin/libpython${PKG_VERSION%.*}{{ abi_suffix }}.a # [osx] + - VER=${PKG_VERSION%.*} # [not win] + - VERABI=${VER} # [not win] + - VERABI=${VERABI}t # [not win and freethreading == "yes"] + - VERABI_NO_DBG=${VERABI} # [not win] + - VERABI=${VERABI}d # [not win and build_type == "debug"] + - 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] - - popd # [unix] -{% endif %} - name: python-freethreading build: noarch: generic -{% if gil_type == "normal" %} - skip: True -{% endif %} + skip: true # [freethreading == "no"] requirements: - python {{ version }}{{ dev }}.* - python_abi * *_{{ abi_tag }} @@ -367,9 +305,7 @@ outputs: - name: python-gil build: noarch: generic -{% if gil_type == "disabled" %} - skip: True -{% endif %} + skip: true # [freethreading == "yes"] requirements: - python {{ version }}{{ dev }}.* - python_abi * *_{{ abi_tag }} @@ -378,10 +314,10 @@ outputs: script: install_jit_activation.sh # [not win] script: install_jit_activation.bat # [win] build: -{% if gil_type == "disabled" %} - skip: True -{% endif %} - skip: true # [py<313] + skip: true # [freethreading == "yes"] + skip: true # [build_type == "debug"] + # Mirror build_base.sh JIT gate: yes-off only when not debug, not freethreading, and target_platform matches *-64 + skip: true # [not linux64 and not win64 and not (osx and x86_64)] noarch: generic requirements: - python {{ version }}{{ dev }} @@ -423,5 +359,3 @@ extra: - scopatz - katietz - xhochy - skip-lints: - - license_file_overspecified diff --git a/recipe/run_test.py b/recipe/run_test.py index 132c270a..2eb10a2d 100644 --- a/recipe/run_test.py +++ b/recipe/run_test.py @@ -22,6 +22,8 @@ print('tuple.__itemsize__:', tuple.__itemsize__) if sys.platform == 'win32': assert 'MSC v.19' in sys.version +if hasattr(sys, "abiflags"): + print('sys.abiflags', sys.abiflags) print('sys.maxunicode:', sys.maxunicode) print('platform.architecture:', platform.architecture()) print('platform.python_version:', platform.python_version()) @@ -72,12 +74,18 @@ import test.support import unicodedata import zlib +import compression.zstd from os import urandom import os t = 100 * b'Foo ' assert lzma.decompress(lzma.compress(t)) == t +if os.getenv('PY_INTERP_DEBUG') == 'yes': + if sys.platform != 'win32': + assert 'd' in sys.abiflags + assert 'gettotalrefcount' in dir(sys) + if sys.platform != 'win32': if not (ppc64le or armv7l): import _curses