]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/VerSection.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / VerSection.py
index 11e974b9936e8435005d18841ba51cee480709e8..1e7b3914127ef33456d50d6b09eeae51a0032031 100644 (file)
@@ -1,27 +1,21 @@
 ## @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
-#  which accompanies this distribution.  The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 ##\r
 # Import Modules\r
 #\r
-from Ffs import Ffs\r
-import Section\r
+from __future__ import absolute_import\r
+from .Ffs import SectionSuffix\r
 import Common.LongFilePathOs as os\r
-import subprocess\r
-from GenFdsGlobalVariable import GenFdsGlobalVariable\r
+from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import VerSectionClassObject\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.DataType import SUP_MODULE_SEC\r
 \r
 ## generate version section\r
 #\r
@@ -52,29 +46,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 + '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