[Lldb-commits] [lldb] r214618 - Make the swig generation script use the correct python executable.

Zachary Turner zturner at google.com
Sat Aug 2 00:11:23 PDT 2014


Author: zturner
Date: Sat Aug  2 02:11:22 2014
New Revision: 214618

URL: http://llvm.org/viewvc/llvm-project?rev=214618&view=rev
Log:
Make the swig generation script use the correct python executable.

It was hardcoding the value "python", which will end up at best
getting a different python executable (if the user has overridden
the value of PYTHON_EXECUTABLE), and at worst encountering an
error (if there is no copy of python on the system path).

This patch changes the script to use sys.executable so that it
runs the sub-script with the same executable that it was run with.

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

Modified: lldb/trunk/scripts/Python/buildSwigPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/buildSwigPython.py?rev=214618&r1=214617&r2=214618&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/buildSwigPython.py (original)
+++ lldb/trunk/scripts/Python/buildSwigPython.py Sat Aug  2 02:11:22 2014
@@ -26,6 +26,7 @@
 
 # Python modules:
 import os			# Provide directory and file handling, determine OS information
+import sys			# sys.executable
 import time			# Time access and conversions
 import subprocess 	# Call external programs
 import shutil		# File handling
@@ -533,7 +534,7 @@ def run_python_script( vDictArgs, vstrAr
 	strMsg = "";
 	bDbg = vDictArgs.has_key( "-d" );
 	
-	strPy = "python %s" % vstrArgs;
+	strPy = "%s %s" % (sys.executable, vstrArgs);
 	process = subprocess.Popen( strPy, shell=True );
 	strStdOut, strStdErr = process.communicate();
 	nResult = process.returncode;





More information about the lldb-commits mailing list