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

URL: http://llvm.org/viewvc/llvm-project?rev=284100&view=rev
Log:
Fix Python binding generation build step on Windows

Summary:
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 modify-python-lldb.py 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: https://reviews.llvm.org/D25396

Modified:
    lldb/trunk/scripts/Python/prepare_binding_Python.py

Modified: lldb/trunk/scripts/Python/prepare_binding_Python.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/prepare_binding_Python.py?rev=284100&r1=284099&r2=284100&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/prepare_binding_Python.py (original)
+++ lldb/trunk/scripts/Python/prepare_binding_Python.py 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)
         sys.exit(-11)
 
-    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
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to