From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ching.jenx.cheng@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Mon, 19 Aug 2019 00:21:09 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Aug 2019 00:21:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,403,1559545200"; d="scan'208";a="353161344" Received: from unknown (HELO chingjex-MOBL.gar.corp.intel.com) ([10.5.246.20]) by orsmga005.jf.intel.com with ESMTP; 19 Aug 2019 00:21:07 -0700 From: "Cheng, Ching JenX" To: devel@edk2.groups.io Cc: Amy Chan , Michael Kubacki , Chasel Chiu , Nate DeSimone , Liming Gao Subject: [PATCH] Python run fail if env variable PYTHON_HOME is not set Date: Mon, 19 Aug 2019 15:21:28 +0800 Message-Id: <20190819072128.15400-1-ching.jenx.cheng@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2041 In Platform\Intel\MinPlatformPkg\Tools\Fsp\RebaseFspBinBaseAddress.py It will run another python code. But if the environment variable "PYTHON_HOME" is not exist and we didn't add any python's path to "PATH". It will cause error because python command not found. the error message as below: 'python' is not recognized as an internal or external command, operable program or batch file. So we set the python's path from which execute the python code if PYTHON_HOME was not exist. Cc: Amy Chan Cc: Michael Kubacki Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Signed-off-by: Ching JenX Cheng --- Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py index 406e5ec130..1d72b4112f 100644 --- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py +++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py @@ -76,6 +76,8 @@ file.close() pythontool = 'python' if 'PYTHON_HOME' in os.environ: pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python' +else: + pythontool = sys.executable Process = subprocess.Popen([pythontool, splitFspBinPath, "info","-f",fspBinFilePath], stdout=subprocess.PIPE) Output = Process.communicate()[0] FsptInfo = Output.rsplit(b"FSP_M", 1); -- 2.21.0.windows.1