aboutsummaryrefslogtreecommitdiff
path: root/lldb/scripts/Python/prepare_binding_Python.py
diff options
context:
space:
mode:
authorVadim Macagon <vadim.macagon@gmail.com>2016-10-13 04:07:22 +0000
committerVadim Macagon <vadim.macagon@gmail.com>2016-10-13 04:07:22 +0000
commitbdff2dc8d775948284471d15d15dc0d4d345c409 (patch)
tree8242e2a140031cb5d359c556181be05906a2a128 /lldb/scripts/Python/prepare_binding_Python.py
parent5068d7a338fea589baad6e4f4330937268c7127d (diff)
downloadllvm-bdff2dc8d775948284471d15d15dc0d4d345c409.zip
llvm-bdff2dc8d775948284471d15d15dc0d4d345c409.tar.gz
llvm-bdff2dc8d775948284471d15d15dc0d4d345c409.tar.bz2
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
Diffstat (limited to 'lldb/scripts/Python/prepare_binding_Python.py')
-rw-r--r--lldb/scripts/Python/prepare_binding_Python.py8
1 files changed, 4 insertions, 4 deletions
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):