diff options
author | Feng, Bob C <bob.c.feng@intel.com> | 2019-09-04 13:00:37 +0800 |
---|---|---|
committer | Feng, Bob C <bob.c.feng@intel.com> | 2019-09-17 10:19:05 +0800 |
commit | 0075ab2cec500fc679c6b2e4990142b4a2e51050 (patch) | |
tree | dd5fe19ef82620090e1733e9f7e3322bdf9e1f15 /BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | |
parent | bc9e4194cf3edaf9524c83098ba3f72008c70190 (diff) | |
download | edk2-0075ab2cec500fc679c6b2e4990142b4a2e51050.tar.gz edk2-0075ab2cec500fc679c6b2e4990142b4a2e51050.tar.bz2 edk2-0075ab2cec500fc679c6b2e4990142b4a2e51050.zip |
BaseTools: remove unnecessary calls of os.exist
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2101
This patch is going to remove unnecessary calls
of os.exist()
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/PlatformAutoGen.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py index 0e424ee40f..debeb46f58 100644 --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py @@ -275,11 +275,11 @@ class PlatformAutoGen(AutoGen): PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]
if PcdNvStoreDfBuffer:
- if os.path.exists(VpdMapFilePath):
+ try:
OrgVpdFile.Read(VpdMapFilePath)
PcdItems = OrgVpdFile.GetOffset(PcdNvStoreDfBuffer[0])
NvStoreOffset = list(PcdItems.values())[0].strip() if PcdItems else '0'
- else:
+ except:
EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)
NvStoreOffset = int(NvStoreOffset, 16) if NvStoreOffset.upper().startswith("0X") else int(NvStoreOffset)
@@ -665,7 +665,7 @@ class PlatformAutoGen(AutoGen): # Process VPD map file generated by third party BPDG tool
if NeedProcessVpdMapFile:
VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
- if os.path.exists(VpdMapFilePath):
+ try:
VpdFile.Read(VpdMapFilePath)
# Fixup TAB_STAR offset
@@ -679,7 +679,7 @@ class PlatformAutoGen(AutoGen): for item in vpdinfo:
if item[2] == pcdvalue:
sku.VpdOffset = item[1]
- else:
+ except:
EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)
# Delete the DynamicPcdList At the last time enter into this function
|