From 19f824d99717fe9f74ff9a83e41a1dd9cbc10200 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Sep 2024 08:47:47 -0500 Subject: [PATCH 1/5] Fix import lib --- recipe/build_base.bat | 1 + recipe/meta.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/recipe/build_base.bat b/recipe/build_base.bat index d3dc8553..eb00a052 100644 --- a/recipe/build_base.bat +++ b/recipe/build_base.bat @@ -132,6 +132,7 @@ for %%x in (idle pydoc) do ( :: Populate the libs directory if not exist %PREFIX%\libs mkdir %PREFIX%\libs +dir %SRC_DIR%\PCbuild\%BUILD_PATH%\ if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib %PREFIX%\libs\ diff --git a/recipe/meta.yaml b/recipe/meta.yaml index b9136b3a..f2e79cd1 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -229,6 +229,8 @@ outputs: - 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] + - if not exist %PREFIX%\\libs\\python3.lib exit 1 # [win] + - if not exist %PREFIX%\\libs\\python3{{ ver2nd }}.lib exit 1 # [win] # https://github.com/conda-forge/python-feedstock/issues/384 - if exist %PREFIX%\\Scripts\\pydoc exit 1 # [win] - if exist %PREFIX%\\Scripts\\idle exit 1 # [win] From e1a40557381466659c6b40e69ee606ff53634857 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Sep 2024 09:07:02 -0500 Subject: [PATCH 2/5] fix .lib and .pdb file names --- recipe/build_base.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipe/build_base.bat b/recipe/build_base.bat index eb00a052..8d76ba86 100644 --- a/recipe/build_base.bat +++ b/recipe/build_base.bat @@ -75,7 +75,7 @@ for %%x in (python%VERNODOTS%%THREAD%%_D%.dll python3%THREAD%%_D%.dll python%EXE ) ) -for %%x in (python%_D%.pdb python%VERNODOTS%%_D%.pdb pythonw%_D%.pdb) do ( +for %%x in (python%THREAD%%_D%.pdb python%VERNODOTS%%THREAD%%_D%.pdb pythonw%THREAD%%_D%.pdb) do ( if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x ( copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX% ) else ( @@ -133,11 +133,11 @@ for %%x in (idle pydoc) do ( :: Populate the libs directory if not exist %PREFIX%\libs mkdir %PREFIX%\libs dir %SRC_DIR%\PCbuild\%BUILD_PATH%\ -if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib %PREFIX%\libs\ +if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 -if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib %PREFIX%\libs\ +if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 -if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib %PREFIX%\libs\ +if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%THREAD%%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 From ce05232f8897dc0a433efbcaab1b387dea6298b8 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Sep 2024 09:34:40 -0500 Subject: [PATCH 3/5] Fix test and cleanup --- recipe/build_base.bat | 24 +++++++----------------- recipe/meta.yaml | 9 +++++++-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/recipe/build_base.bat b/recipe/build_base.bat index 8d76ba86..f4fb7abd 100644 --- a/recipe/build_base.bat +++ b/recipe/build_base.bat @@ -164,7 +164,6 @@ if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe ( echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe does not exist" ) - :: Remove test data to save space. :: Though keep `support` as some things use that. mkdir %PREFIX%\Lib\test_keep @@ -177,24 +176,15 @@ rd /s /q %PREFIX%\Lib\test if errorlevel 1 exit 1 move %PREFIX%\Lib\test_keep %PREFIX%\Lib\test if errorlevel 1 exit 1 -rd /s /q %PREFIX%\Lib\lib2to3\tests\ -if errorlevel 1 exit 1 - -:: bytecode compile the standard library - -rd /s /q %PREFIX%\Lib\lib2to3\tests\ -if errorlevel 1 exit 1 :: We need our Python to be found! if "%_D%" neq "" copy %PREFIX%\python%_D%.exe %PREFIX%\python.exe if "%EXE_T%" neq "" copy %PREFIX%\python%EXE_T%.exe %PREFIX%\python.exe +:: bytecode compile the standard library %PREFIX%\python.exe -Wi %PREFIX%\Lib\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\Lib if errorlevel 1 exit 1 -:: Pickle lib2to3 Grammar -%PREFIX%\python.exe -m lib2to3 --help - :: Ensure that scripts are generated :: https://github.com/conda-forge/python-feedstock/issues/384 %PREFIX%\python.exe %RECIPE_DIR%\fix_staged_scripts.py @@ -202,19 +192,19 @@ if errorlevel 1 exit 1 :: Some quick tests for common failures echo "Testing print() does not print: Hello" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello" +%PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello" if %errorlevel% neq 1 exit /b 1 echo "Testing print('Hello') prints: Hello" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe "print('Hello')" 2>&1 | findstr /r /c:"Hello" +%PREFIX%\python.exe -c "print('Hello')" 2>&1 | findstr /r /c:"Hello" if %errorlevel% neq 0 exit /b 1 echo "Testing import of os (no DLL needed) does not print: The specified module could not be found" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import os" 2>&1 -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found" +%PREFIX%\python.exe -v -c "import os" 2>&1 +%PREFIX%\python.exe -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found" if %errorlevel% neq 1 exit /b 1 echo "Testing import of _sqlite3 (DLL located via PATH needed) does not print: The specified module could not be found" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found" +%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 +%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found" if %errorlevel% neq 1 exit /b 1 diff --git a/recipe/meta.yaml b/recipe/meta.yaml index f2e79cd1..8551bfb0 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -229,8 +229,13 @@ outputs: - 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] - - if not exist %PREFIX%\\libs\\python3.lib exit 1 # [win] - - if not exist %PREFIX%\\libs\\python3{{ ver2nd }}.lib exit 1 # [win] + {% 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] + {%e else %} + - if not exist %PREFIX%\\libs\\python3.lib exit 1 # [win] + - if not exist %PREFIX%\\libs\\python{{ ver2nd }}.lib exit 1 # [win] + {% endif %} # https://github.com/conda-forge/python-feedstock/issues/384 - if exist %PREFIX%\\Scripts\\pydoc exit 1 # [win] - if exist %PREFIX%\\Scripts\\idle exit 1 # [win] From 12a696bfdff2e2037c99f6a406fb84355aaae664 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Sep 2024 09:37:34 -0500 Subject: [PATCH 4/5] fix typo --- recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 8551bfb0..52b1151c 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -232,7 +232,7 @@ outputs: {% 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] - {%e else %} + {% else %} - if not exist %PREFIX%\\libs\\python3.lib exit 1 # [win] - if not exist %PREFIX%\\libs\\python{{ ver2nd }}.lib exit 1 # [win] {% endif %} From 40b619020957793eea20b762273c80f5978b988d Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Sep 2024 10:33:53 -0500 Subject: [PATCH 5/5] Fix test --- recipe/meta.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 52b1151c..0ae49dbc 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' %} @@ -249,10 +249,8 @@ outputs: - bash build-and-test.sh # [unix] - popd # [unix] - pushd cmake -{% if freethreading == "yes" %} - - 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 %} +{% if freethreading == "no" %} + # TODO: use the new FindPython3 which supports freethreading - cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . {% endif %} - popd