Skip to content

Commit c67c663

Browse files
committed
refactor: limit quotes to terms with spaces
during testing it was extremely helpful having the error identify which vswhere command had been executed, and even more helpful being able to paste it. since most visual studio paths have spaces in them, that's not possible unless those terms have quotes around them, e.g. "C:\Program Files (x86)\Microsoft\Visual Studio\...\vswhere.exe" -products ...
1 parent 8ed9d24 commit c67c663

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpython-windows/build.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ def find_vs_path(path, msvc_version):
260260
]
261261
p = subprocess.check_output(cmdline)
262262
if not p:
263-
cmd = " ".join('"%s"' % i for i in cmdline)
264-
print("could not find visual studio (using '%s')" % cmd)
263+
# add quotes around any of the terms with spaces in them, so that
264+
# the user can copy-and-paste the command.
265+
cmdline = ['"%s"' % term if " " in term else term for term in cmdline]
266+
print("could not find visual studio (using '%s')" % cmdline)
265267
sys.exit(1)
266268

267269
# Strictly speaking the output may not be UTF-8.

0 commit comments

Comments
 (0)