Set PYTHON_HOME env variable for Windows build (#53)

The latest SBL source code does not build on certain environment.
For example, when PYTHON_HOME is not set manually, it will cause
build failure due to invalid path for python.exe.  This patch will
set the PYTHON_HOME env variable if it has not been set already.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
Maurice Ma 2018-12-05 11:35:44 -08:00 committed by Aiden Park
parent 3f8ccfd9b1
commit a8f5e06c5b
1 changed files with 2 additions and 2 deletions

View File

@ -44,12 +44,12 @@ def rebuild_basetools ():
ret = subprocess.call(['make', '-C', 'BaseTools'])
elif os.name == 'nt':
if 'PYTHON_HOME' not in os.environ:
os.environ['PYTHON_HOME'] = 'C:\\Python27'
genffs_exe_path = os.path.join(sblsource, 'BaseTools', 'Bin', 'Win32', 'GenFfs.exe')
genffs_exist = os.path.exists(genffs_exe_path)
if not genffs_exist:
print "Could not find pre-built BaseTools binaries, try to rebuild BaseTools ..."
if 'PYTHON_HOME' not in os.environ:
os.environ['PYTHON_HOME'] = 'C:\\Python27'
ret = subprocess.call(['BaseTools\\toolsetup.bat', 'forcerebuild'])
if ret: