Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows build #909

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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"])

Check warning on line 351 in pytensor/configdefaults.py

View check run for this annotation

Codecov / codecov/patch

pytensor/configdefaults.py#L351

Added line #L351 was not covered by tests
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
Loading