[edk2-devel] [edk2-platforms: PATCH v2] Python run fail if env variable PYTHON_HOME is not set

Nate DeSimone nathaniel.l.desimone at intel.com
Mon Aug 19 19:04:40 UTC 2019


Reviewed-by: Nate DeSimone <nathaniel.l.desimone at intel.com>

-----Original Message-----
From: Cheng, Ching JenX 
Sent: Monday, August 19, 2019 2:24 AM
To: devel at edk2.groups.io
Cc: Chan, Amy <amy.chan at intel.com>; Kubacki, Michael A <michael.a.kubacki at intel.com>; Chiu, Chasel <chasel.chiu at intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone at intel.com>; Gao, Liming <liming.gao at intel.com>
Subject: [edk2-platforms: PATCH v2] Python run fail if env variable PYTHON_HOME is not set

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2041

[PATCH v2] Update related files

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 <amy.chan at intel.com>
Cc: Michael Kubacki <michael.a.kubacki at intel.com>
Cc: Chasel Chiu <chasel.chiu at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Cc: Liming Gao <liming.gao at intel.com>
Signed-off-by: Ching JenX Cheng <ching.jenx.cheng at intel.com>
---
 Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
index a8165b08e6..fb4cf4f9b7 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
@@ -68,6 +68,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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46051): https://edk2.groups.io/g/devel/message/46051
Mute This Topic: https://groups.io/mt/32942124/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list