Skip to content

Commit e31bd8f

Browse files
committed
Set PATH for the Windows consumer program with any compiler
Windows runners find MinGW gcc before cl, and the program needs the library directory on PATH either way. The same change is in python-project-templates/base#223. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
1 parent 9074f0a commit e31bd8f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎python_template_cpp/tests/test_all.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ def test_c_consumer_builds_against_the_installed_package(tmp_path):
6464
source.write_text(C_CONSUMER)
6565
executable = tmp_path / ("consumer.exe" if platform == "win32" else "consumer")
6666
env = dict(os.environ)
67+
if platform == "win32":
68+
# Windows has no rpath, so the program finds the DLL through PATH whichever compiler built it.
69+
env["PATH"] = library_dir + os.pathsep + env["PATH"]
6770
if Path(compiler).stem.lower() == "cl":
6871
command = [compiler, "/nologo", f"/I{get_include()}", str(source), f"/Fe:{executable}", "/link", f"/LIBPATH:{library_dir}", f"{library}.lib"]
69-
env["PATH"] = library_dir + os.pathsep + env["PATH"]
7072
else:
7173
command = [
7274
compiler,

0 commit comments

Comments
 (0)