From f82dda25115d088134cfeb67ed3ad8c2b7a5c91c Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 27 Aug 2026 19:49:02 +1100 Subject: [PATCH 1/3] actually move python*.dll to libpython on windows --- recipe/install_base.bat | 2 +- recipe/install_shared.bat | 37 +++++++++++++++++++++++++++++++++++++ recipe/meta.yaml | 10 +++------- 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 recipe/install_shared.bat diff --git a/recipe/install_base.bat b/recipe/install_base.bat index 2d7485a2d..92fdaeb19 100644 --- a/recipe/install_base.bat +++ b/recipe/install_base.bat @@ -51,7 +51,7 @@ if "%PY_FREETHREADING%" == "yes" ( ) :: 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 ( +for %%x in (python%EXE_T%%_D%.exe pythonw%EXE_T%%_D%.exe) do ( if exist %SRC_DIR%\PCbuild\%HOST_DIR%\%%x ( copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\%%x %PREFIX% ) else ( diff --git a/recipe/install_shared.bat b/recipe/install_shared.bat new file mode 100644 index 000000000..ddbb53dde --- /dev/null +++ b/recipe/install_shared.bat @@ -0,0 +1,37 @@ +setlocal EnableDelayedExpansion +echo on + +if "%target_platform%"=="win-64" ( + set HOST_DIR=amd64 +) +if "%target_platform%"=="win-32" ( + set HOST_DIR=win32 +) +if "%target_platform%"=="win-arm64" ( + set HOST_DIR=arm64 +) + +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + set "VERNODOTS=%%i%%j" +) + +if "%PY_INTERP_DEBUG%"=="yes" ( + set _D=_d +) else ( + set _D= +) + +if "%PY_FREETHREADING%" == "yes" ( + set "THREAD=t" +) else ( + set "THREAD=" +) + +:: move python*.dll +for %%x in (python%VERNODOTS%%THREAD%%_D%.dll python3%THREAD%%_D%.dll) do ( + if exist %SRC_DIR%\PCbuild\%HOST_DIR%\%%x ( + copy /Y %SRC_DIR%\PCbuild\%HOST_DIR%\%%x %PREFIX% + ) else ( + echo "WARNING :: %SRC_DIR%\PCbuild\%HOST_DIR%\%%x does not exist" + ) +) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e83cbc50d..5d11ebdad 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 = 1 %} +{% set build_number = 2 %} # this makes the linter happy {% set channel_targets = channel_targets or 'conda-forge main' %} @@ -322,11 +322,7 @@ outputs: - name: libpython script: install_shared.sh # [unix] - files: # [win] - - python3.dll # [win] - - python3t.dll # [win] - - python{{ ver2nd }}.dll # [win] - - python{{ ver2nd }}t.dll # [win] + script: install_shared.bat # [win] build: number: {{ build_number }} activate_in_script: true @@ -352,7 +348,7 @@ outputs: - {{ compiler('cxx') }} # build-and-test.sh needs to find `Python.h`; can't do pin_subpackage # due to the way conda-build (mis-)populates the package hashes - - python {{ version }} *_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} + - python {{ version }} *_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} # [unix] - ripgrep - cmake - ninja From 4f37d40a615740306cf1830b7883f1402aae60ad Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 28 Aug 2026 07:42:31 +1100 Subject: [PATCH 2/3] move script-based libpython tests to python output after reversal of the build order, these tests are in the wrong place and only held together by re-injecting the full `python` as a test dep, which also hides problems with the files-based tests. --- recipe/meta.yaml | 27 ++++--------------- .../prefix-replacement/build-and-test.sh | 2 +- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 5d11ebdad..a2d83cb65 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -265,6 +265,7 @@ outputs: files: - tests/cmake/* - tests/cython/* + - tests/prefix-replacement/* - run_test.py commands: - echo on # [win] @@ -308,7 +309,11 @@ 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 + - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" {{ cmake_debug }} . - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Module" {{ cmake_debug }} . - popd - popd @@ -338,20 +343,6 @@ outputs: - {{ compiler('c') }} - {{ compiler('cxx') }} test: - files: - - tests/cmake/* - - tests/prefix-replacement/* - requires: - - {{ stdlib('c') }} - - {{ compiler('c') }} - # cmake expects a C++ compiler for some reason - - {{ compiler('cxx') }} - # build-and-test.sh needs to find `Python.h`; can't do pin_subpackage - # due to the way conda-build (mis-)populates the package hashes - - python {{ version }} *_{{ PKG_BUILDNUM }}{{ debug }}_{{ abi_tag }} # [unix] - - ripgrep - - cmake - - ninja commands: - VER=${PKG_VERSION%.*} # [not win] - VERABI=${VER} # [not win] @@ -372,14 +363,6 @@ outputs: - if not exist %PREFIX%\python3.dll exit 1 # [win] - if not exist %PREFIX%\python{{ ver2nd }}.dll exit 1 # [win] {% endif %} - - pushd tests - - pushd prefix-replacement # [unix] - - bash build-and-test.sh # [unix] - - popd # [unix] - - pushd cmake - - cmake -GNinja {{ cmake_test_args }} -DPY_VER={{ version }} -DEXTRA_COMPONENTS="Development.Embed" {{ cmake_debug }} . - - popd - - popd - name: libpython-static script: install_static.sh # [unix] diff --git a/recipe/tests/prefix-replacement/build-and-test.sh b/recipe/tests/prefix-replacement/build-and-test.sh index d710bde75..670d76d63 100644 --- a/recipe/tests/prefix-replacement/build-and-test.sh +++ b/recipe/tests/prefix-replacement/build-and-test.sh @@ -3,7 +3,7 @@ set -ex case ${PKG_NAME} in - libpython) + python) # see bpo44182 for why -L${CONDA_PREFIX}/lib is added ${CC} a.c $(python3-config --cflags) \ $(python3-config --embed --ldflags) \ From 4a842a4025ab5abc5b605f12bac6c362e97827be Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 28 Aug 2026 07:44:30 +1100 Subject: [PATCH 3/3] avoid picking up python from image seen on prior libpython tests (where CMake picked up the wrong executable) ``` -- Found Python: C:/hostedtoolcache/windows/Python/3.14.7/x64/python3.exe (found suitable version "3.14.7", minimum required is "3.14.7") found components: Interpreter Development.Embed ``` --- recipe/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index a2d83cb65..5d73820b5 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -270,6 +270,8 @@ outputs: commands: - echo on # [win] - set # [win] + # ensure we don't pick up python from the image by accident + - rmdir /s /q C:\hostedtoolcache\windows\Python # [win] - python -V - python3 -V # [not win] - pydoc -h