Skip to content

Commit

Permalink
Fix Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Armavica authored and ricardoV94 committed Jul 10, 2024
1 parent 68d9b80 commit 223b739
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pytensor/configdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def add_compile_configvars():
if sys.platform == "win32":
mingw_w64_gcc = Path(sys.executable).parent / "Library/mingw-w64/bin/g++"
try:
rc = call_subprocess_Popen([mingw_w64_gcc, "-v"])
rc = call_subprocess_Popen([str(mingw_w64_gcc), "-v"])
if rc == 0:
maybe_add_to_os_environ_pathlist("PATH", mingw_w64_gcc.parent)
except OSError:
Expand Down
8 changes: 4 additions & 4 deletions pytensor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ def maybe_add_to_os_environ_pathlist(var: str, newpath: Path | str) -> None:
pass


def subprocess_Popen(command, **params):
def subprocess_Popen(command: str | list[str], **params):
"""
Utility function to work around windows behavior that open windows.
:see: call_subprocess_Popen and output_subprocess_Popen
"""
startupinfo = None
if os.name == "nt":
startupinfo = subprocess.STARTUPINFO()
startupinfo = subprocess.STARTUPINFO() # type: ignore[attr-defined]
try:
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # type: ignore[attr-defined]
except AttributeError:
startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW # type: ignore[attr-defined]

# Anaconda for Windows does not always provide .exe files
# in the PATH, they also have .bat files that call the corresponding
Expand Down

0 comments on commit 223b739

Please sign in to comment.