From bdff2dc8d775948284471d15d15dc0d4d345c409 Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Thu, 13 Oct 2016 04:07:22 +0000 Subject: 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 llvm-svn: 284100 --- lldb/scripts/Python/prepare_binding_Python.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lldb/scripts/Python/prepare_binding_Python.py') diff --git a/lldb/scripts/Python/prepare_binding_Python.py b/lldb/scripts/Python/prepare_binding_Python.py index 1688af4..107f897 100644 --- a/lldb/scripts/Python/prepare_binding_Python.py +++ b/lldb/scripts/Python/prepare_binding_Python.py @@ -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, config_build_dir): 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): -- cgit v1.1