[PATCH v1] MinPlatformPkg/Fsp: Rebase fail when python tools path exist whitespace


IanX Kuo
 

From: IanX Kuo <ianx.kuo@intel.com>

(a) C:\Users\<UserName>\AppData\Local\Program\Python\Python38
(b) C:\Python38
(c) C:\Program Files\Python38
Issue only happens on (a) and (c).
(a) happen on <UserName> have whitespace. Ex: Tony Chen
(c) happen on "Program Files" have whitespace.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
---
.../Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py | 6 +++++-
.../MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBa=
seAddress.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBin=
BaseAddress.py
index 406e5ec130..de2d49d55e 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddre=
ss.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddre=
ss.py
@@ -1,6 +1,6 @@
## @ RebaseAndPatchFspBinBaseAddress.py=0D
#=0D
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
=0D
@@ -76,6 +76,10 @@ file.close()
pythontool =3D 'python'=0D
if 'PYTHON_HOME' in os.environ:=0D
pythontool =3D os.environ['PYTHON_HOME'] + os.sep + 'python'=0D
+else:=0D
+ pythontool =3D sys.executable=0D
+pythontool =3D "\"" + pythontool + "\""=0D
+=0D
Process =3D subprocess.Popen([pythontool, splitFspBinPath, "info","-f",fsp=
BinFilePath], stdout=3Dsubprocess.PIPE)=0D
Output =3D Process.communicate()[0]=0D
FsptInfo =3D Output.rsplit(b"FSP_M", 1);=0D
diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddres=
s.py b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
index fb4cf4f9b7..d9adb78ca2 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
@@ -1,6 +1,6 @@
## @ RebaseFspBinBaseAddress.py=0D
#=0D
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
=0D
@@ -70,6 +70,8 @@ if 'PYTHON_HOME' in os.environ:
pythontool =3D os.environ['PYTHON_HOME'] + os.sep + 'python'=0D
else:=0D
pythontool =3D sys.executable=0D
+pythontool =3D "\"" + pythontool + "\""=0D
+=0D
Process =3D subprocess.Popen([pythontool, splitFspBinPath, "info","-f",fsp=
BinFilePath], stdout=3Dsubprocess.PIPE)=0D
Output =3D Process.communicate()[0]=0D
FsptInfo =3D Output.rsplit(b"FSP_M", 1);=0D
--=20
2.30.0.windows.1

Join devel@edk2.groups.io to automatically receive all group messages.