Author: enlight
Date: Wed Oct 12 23:07:22 2016
New Revision: 284100

Fix Python binding generation build step on Windows

If Python is installed to a location that contains spaces
(e.g. "C:\Program Files\Python3") then the build fails while attempting
to run the script because the path to the Python
executable is not double-quoted before being passed to the shell. The
fix consists of letting Python handle the formatting of the command
line, since subprocess.Popen() is perfectly capable of handling paths
containing spaces if it's given the command and arguments as a list
instead of a single pre-formatted string.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

Differential Revision:


Modified: lldb/trunk/scripts/Python/
--- lldb/trunk/scripts/Python/ (original)
+++ lldb/trunk/scripts/Python/ Wed Oct 12 23:07:22 2016
@@ -264,8 +264,9 @@ def run_python_script(script_and_args):
     @param script_and_args the python script to execute, along with
     the command line arguments to pass to it.
-    command_line = "%s %s" % (sys.executable, script_and_args)
-    process = subprocess.Popen(command_line, shell=True)
+    command = [sys.executable] + script_and_args
+    command_line = " ".join(command)
+    process = subprocess.Popen(command, shell=False)
     script_stdout, script_stderr = process.communicate()
     return_code = process.returncode
     if return_code != 0:
@@ -294,8 +295,7 @@ def do_modify_python_lldb(options, confi
         logging.error("failed to find python script: '%s'", script_path)
-    script_invocation = "%s %s" % (script_path, config_build_dir)
-    run_python_script(script_invocation)
+    run_python_script([script_path, config_build_dir])
 def get_python_module_path(options):

lldb-commits mailing list

Reply via email to