8000 MAINT: testing: specify python executable to use in extbuild (#28183) · ngoldbaum/numpy@0b49d43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0b49d43

Browse files
authored
MAINT: testing: specify python executable to use in extbuild (numpy#28183)
This would cause failures during testing distribution packages on Cygwin. The code is copied from meson-python, as advised in mesonbuild/meson-python#51 and amended in mesonbuild/meson-python#137. Note the changed organization in many of the links. The same pattern is also present in other NumPy test files where extension modules are build as part of the test suite.
1 parent af9f607 commit 0b49d43

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

numpy/testing/_private/extbuild.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,20 @@ def build(cfile, outputfilename, compile_extra, link_extra,
220220
include_directories: {include_dirs},
221221
)
222222
"""))
223+
native_file_name = cfile.parent / ".mesonpy-native-file.ini"
224+
with open(native_file_name, "wt") as fid:
225+
fid.write(textwrap.dedent(f"""\
226+
[binaries]
227+
python = '{sys.executable}'
228+
"""))
223229
if sys.platform == "win32":
224230
subprocess.check_call(["meson", "setup",
225231
"--buildtype=release",
226232
"--vsenv", ".."],
227233
cwd=build_dir,
228234
)
229235
else:
230-
subprocess.check_call(["meson", "setup", "--vsenv", ".."],
236+
subprocess.check_call(["meson", "setup", "--vsenv", "..", f'--native-file={os.fspath(native_file_name)}'],
231237
cwd=build_dir
232238
)
233239

0 commit comments

Comments
 (0)
0