X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FGenFds%2FVerSection.py;h=11e974b9936e8435005d18841ba51cee480709e8;hp=e27d0a20f97f32bc9dd0a9ebb65f7cf413a9990d;hb=4231a8193ec0d52df7e0a101d96c51b1a2b7a996;hpb=30fdf1140b8d1ce93f3821d986fa165552023440 diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py index e27d0a20f9..11e974b993 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -1,9 +1,9 @@ ## @file # process Version section generation # -# Copyright (c) 2007, Intel Corporation +# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# -# All rights reserved. This program and the accompanying materials +# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -17,10 +17,11 @@ # from Ffs import Ffs import Section -import os +import Common.LongFilePathOs as os import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import VerSectionClassObject +from Common.LongFilePathSupport import OpenLongFilePath as open ## generate version section # @@ -47,11 +48,11 @@ class VerSection (VerSectionClassObject): # @param Dict dictionary contains macro and its value # @retval tuple (Generated file name, section alignment) # - def GenSection(self,OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}): + def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf=None, Dict={}, IsMakefile = False): # # Prepare the parameter of GenSection # - if FfsInf != None: + if FfsInf is not None: self.Alignment = FfsInf.__ExtendMacro__(self.Alignment) self.BuildNum = FfsInf.__ExtendMacro__(self.BuildNum) self.StringData = FfsInf.__ExtendMacro__(self.StringData) @@ -63,9 +64,9 @@ class VerSection (VerSectionClassObject): # Get String Data StringData = '' - if self.StringData != None: - StringData = self.StringData - elif self.FileName != None: + if self.StringData is not None: + StringData = self.StringData + elif self.FileName is not None: FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName) FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict) FileObj = open(FileNameStr, 'r') @@ -74,9 +75,8 @@ class VerSection (VerSectionClassObject): FileObj.close() else: StringData = '' - - GenFdsGlobalVariable.GenerateSection(OutputFile, None, 'EFI_SECTION_VERSION', - Ui=StringData, Ver=self.BuildNum) + GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION', + Ver=StringData, BuildNumber=self.BuildNum, IsMakefile=IsMakefile) OutputFileList = [] OutputFileList.append(OutputFile) return OutputFileList, self.Alignment