Skip to content

Commit 080214a

Browse files
maresbmichaelosthege
authored andcommitted
Use lists instead of strings for commands
1 parent cc090e1 commit 080214a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pytensor/link/c/cmodule.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ def get_lines(cmd: list[str] | str, parse: bool = True) -> list[str] | None:
21472147

21482148
# The '-' at the end is needed. Otherwise, g++ do not output
21492149
# enough information.
2150-
native_lines = get_lines(f"{config.cxx} -march=native -E -v -")
2150+
native_lines = get_lines([config.cxx, "-march=native", "-E", "-v", "-"])
21512151
if native_lines is None:
21522152
_logger.info(
21532153
"Call to 'g++ -march=native' failed, not setting -march flag"
@@ -2162,7 +2162,7 @@ def get_lines(cmd: list[str] | str, parse: bool = True) -> list[str] | None:
21622162
# That means we did not select the right lines, so
21632163
# we have to report all the lines instead
21642164
reported_lines = get_lines(
2165-
f"{config.cxx} -march=native -E -v -", parse=False
2165+
[config.cxx, "-march=native", "-E", "-v", "-"], parse=False
21662166
)
21672167
else:
21682168
reported_lines = native_lines
@@ -2175,10 +2175,12 @@ def get_lines(cmd: list[str] | str, parse: bool = True) -> list[str] | None:
21752175
f" problem:\n {reported_lines}"
21762176
)
21772177
else:
2178-
default_lines = get_lines(f"{config.cxx} -E -v -")
2178+
default_lines = get_lines([config.cxx, "-E", "-v", "-"])
21792179
_logger.info(f"g++ default lines: {default_lines}")
21802180
if len(default_lines) < 1:
2181-
reported_lines = get_lines(f"{config.cxx} -E -v -", parse=False)
2181+
reported_lines = get_lines(
2182+
[config.cxx, "-E", "-v", "-"], parse=False
2183+
)
21822184
warnings.warn(
21832185
"PyTensor was not able to find the "
21842186
"default g++ parameters. This is needed to tune "
@@ -2778,7 +2780,7 @@ def check_required_file(paths, required_regexs):
27782780
return libs
27792781

27802782
def get_cxx_library_dirs():
2781-
cmd = f"{config.cxx} -print-search-dirs"
2783+
cmd = [config.cxx, "-print-search-dirs"]
27822784
p = subprocess_Popen(
27832785
cmd,
27842786
stdout=subprocess.PIPE,

0 commit comments

Comments
 (0)