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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user