From c67c663567074ad170508edb9071976a4a48eb19 Mon Sep 17 00:00:00 2001 From: Oliver 'kfsone' Smith Date: Fri, 7 Jun 2024 11:42:07 -0700 Subject: [PATCH] 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 ... --- cpython-windows/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 9ad79b0d..3f9298aa 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -260,8 +260,10 @@ def find_vs_path(path, msvc_version): ] p = subprocess.check_output(cmdline) if not p: - cmd = " ".join('"%s"' % i for i in cmdline) - print("could not find visual studio (using '%s')" % cmd) + # add quotes around any of the terms with spaces in them, so that + # the user can copy-and-paste the command. + cmdline = ['"%s"' % term if " " in term else term for term in cmdline] + print("could not find visual studio (using '%s')" % cmdline) sys.exit(1) # Strictly speaking the output may not be UTF-8.