]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/VerSection.py
BaseTools/GenFds: cleanup GenFds
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / VerSection.py
index db71fe9653d40777466771b519655a9a18abb95e..051743f10c21cdb295889b5a5573bf1fe718f5bd 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process Version section generation\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 # Import Modules\r
 #\r
 from __future__ import absolute_import\r
-from .Ffs import Ffs\r
-from . import Section\r
+from .Ffs import SectionSuffix\r
 import Common.LongFilePathOs as os\r
-import subprocess\r
 from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import VerSectionClassObject\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
@@ -54,29 +52,27 @@ class VerSection (VerSectionClassObject):
         #\r
         # Prepare the parameter of GenSection\r
         #\r
-        if FfsInf is not None:\r
+        if FfsInf:\r
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
             self.BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)\r
             self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r
 \r
         OutputFile = os.path.join(OutputPath,\r
-                                  ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION'))\r
+                                  ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get('VERSION'))\r
         OutputFile = os.path.normpath(OutputFile)\r
 \r
         # Get String Data\r
         StringData = ''\r
-        if self.StringData is not None:\r
+        if self.StringData:\r
             StringData = self.StringData\r
-        elif self.FileName is not None:\r
+        elif self.FileName:\r
             FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
             FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r
             FileObj = open(FileNameStr, 'r')\r
             StringData = FileObj.read()\r
             StringData = '"' + StringData + '"'\r
             FileObj.close()\r
-        else:\r
-            StringData = ''\r
         GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',\r
                                              Ver=StringData, BuildNumber=self.BuildNum, IsMakefile=IsMakefile)\r
         OutputFileList = []\r