Skip to content

Commit 01d89b1

Browse files
Fix import lib (#722)
automerged PR by conda-forge/automerge-action
2 parents 0e0de9a + 40b6190 commit 01d89b1

2 files changed

Lines changed: 22 additions & 26 deletions

File tree

recipe/build_base.bat

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ for %%x in (python%VERNODOTS%%THREAD%%_D%.dll python3%THREAD%%_D%.dll python%EXE
7575
)
7676
)
7777

78-
for %%x in (python%_D%.pdb python%VERNODOTS%%_D%.pdb pythonw%_D%.pdb) do (
78+
for %%x in (python%THREAD%%_D%.pdb python%VERNODOTS%%THREAD%%_D%.pdb pythonw%THREAD%%_D%.pdb) do (
7979
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x (
8080
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%
8181
) else (
@@ -132,11 +132,12 @@ for %%x in (idle pydoc) do (
132132

133133
:: Populate the libs directory
134134
if not exist %PREFIX%\libs mkdir %PREFIX%\libs
135-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib %PREFIX%\libs\
135+
dir %SRC_DIR%\PCbuild\%BUILD_PATH%\
136+
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\
136137
if errorlevel 1 exit 1
137-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib %PREFIX%\libs\
138+
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib %PREFIX%\libs\
138139
if errorlevel 1 exit 1
139-
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib %PREFIX%\libs\
140+
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%THREAD%%_D%.lib %PREFIX%\libs\
140141
if errorlevel 1 exit 1
141142

142143

@@ -163,7 +164,6 @@ if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe (
163164
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe does not exist"
164165
)
165166

166-
167167
:: Remove test data to save space.
168168
:: Though keep `support` as some things use that.
169169
mkdir %PREFIX%\Lib\test_keep
@@ -176,44 +176,35 @@ rd /s /q %PREFIX%\Lib\test
176176
if errorlevel 1 exit 1
177177
move %PREFIX%\Lib\test_keep %PREFIX%\Lib\test
178178
if errorlevel 1 exit 1
179-
rd /s /q %PREFIX%\Lib\lib2to3\tests\
180-
if errorlevel 1 exit 1
181-
182-
:: bytecode compile the standard library
183-
184-
rd /s /q %PREFIX%\Lib\lib2to3\tests\
185-
if errorlevel 1 exit 1
186179

187180
:: We need our Python to be found!
188181
if "%_D%" neq "" copy %PREFIX%\python%_D%.exe %PREFIX%\python.exe
189182
if "%EXE_T%" neq "" copy %PREFIX%\python%EXE_T%.exe %PREFIX%\python.exe
190183

184+
:: bytecode compile the standard library
191185
%PREFIX%\python.exe -Wi %PREFIX%\Lib\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\Lib
192186
if errorlevel 1 exit 1
193187

194-
:: Pickle lib2to3 Grammar
195-
%PREFIX%\python.exe -m lib2to3 --help
196-
197188
:: Ensure that scripts are generated
198189
:: https://github.com/conda-forge/python-feedstock/issues/384
199190
%PREFIX%\python.exe %RECIPE_DIR%\fix_staged_scripts.py
200191
if errorlevel 1 exit 1
201192

202193
:: Some quick tests for common failures
203194
echo "Testing print() does not print: Hello"
204-
%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello"
195+
%PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello"
205196
if %errorlevel% neq 1 exit /b 1
206197

207198
echo "Testing print('Hello') prints: Hello"
208-
%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe "print('Hello')" 2>&1 | findstr /r /c:"Hello"
199+
%PREFIX%\python.exe -c "print('Hello')" 2>&1 | findstr /r /c:"Hello"
209200
if %errorlevel% neq 0 exit /b 1
210201

211202
echo "Testing import of os (no DLL needed) does not print: The specified module could not be found"
212-
%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import os" 2>&1
213-
%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"
203+
%PREFIX%\python.exe -v -c "import os" 2>&1
204+
%PREFIX%\python.exe -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found"
214205
if %errorlevel% neq 1 exit /b 1
215206

216207
echo "Testing import of _sqlite3 (DLL located via PATH needed) does not print: The specified module could not be found"
217-
%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import _sqlite3" 2>&1
218-
%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"
208+
%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1
209+
%PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found"
219210
if %errorlevel% neq 1 exit /b 1

recipe/meta.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{% set ver2 = '.'.join(version.split('.')[0:2]) %}
55
{% set ver2nd = ''.join(version.split('.')[0:2]) %}
66
{% set ver3nd = ''.join(version.split('.')[0:3]) %}
7-
{% set build_number = 2 %}
7+
{% set build_number = 3 %}
88

99
# this makes the linter happy
1010
{% set channel_targets = channel_targets or 'conda-forge main' %}
@@ -229,6 +229,13 @@ outputs:
229229
- 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]
230230
- test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix]
231231
- test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix]
232+
{% if freethreading == "yes" %}
233+
- if not exist %PREFIX%\\libs\\python3t.lib exit 1 # [win]
234+
- if not exist %PREFIX%\\libs\\python{{ ver2nd }}t.lib exit 1 # [win]
235+
{% else %}
236+
- if not exist %PREFIX%\\libs\\python3.lib exit 1 # [win]
237+
- if not exist %PREFIX%\\libs\\python{{ ver2nd }}.lib exit 1 # [win]
238+
{% endif %}
232239
# https://github.com/conda-forge/python-feedstock/issues/384
233240
- if exist %PREFIX%\\Scripts\\pydoc exit 1 # [win]
234241
- if exist %PREFIX%\\Scripts\\idle exit 1 # [win]
@@ -242,10 +249,8 @@ outputs:
242249
- bash build-and-test.sh # [unix]
243250
- popd # [unix]
244251
- pushd cmake
245-
{% if freethreading == "yes" %}
246-
- cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . || true # [unix]
247-
- cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile . || type nul>nul # [win]
248-
{% else %}
252+
{% if freethreading == "no" %}
253+
# TODO: use the new FindPython3 which supports freethreading
249254
- cmake -GNinja -DPY_VER={{ version }} --debug-find --trace --debug-output --debug-trycompile .
250255
{% endif %}
251256
- popd

0 commit comments

Comments
 (0)