From 9e47e6f90880e090cd81f585abd7a6c553fbce10 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Wed, 24 Oct 2018 01:29:19 +0800 Subject: BaseTools/GenFds: cleanup GenFds 1) remove wildcard imports and use explicit imports 2) refactor to use shared variables from Common/DataType 3) rename to not shadow imports 4) don't assign a variable in a loop (just do final assignment) 5) remove spaces, parens, unused or commented out code, etc. 6) merge unnecessary parent classes into child 7) refactor to share DXE and PEI apriori GUIDs from one place this includes changes to Build and EOT files 8) for PEP8, dont use __ for custom methods. Cc: Yonghong Zhu Cc: Liming Gao Cc: Bob C Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/GenFds/VerSection.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'BaseTools/Source/Python/GenFds/VerSection.py') diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py index db71fe9653..051743f10c 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -1,7 +1,7 @@ ## @file # process Version section generation # -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,10 +16,8 @@ # Import Modules # from __future__ import absolute_import -from .Ffs import Ffs -from . import Section +from .Ffs import SectionSuffix import Common.LongFilePathOs as os -import subprocess from .GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import VerSectionClassObject from Common.LongFilePathSupport import OpenLongFilePath as open @@ -54,29 +52,27 @@ class VerSection (VerSectionClassObject): # # Prepare the parameter of GenSection # - if FfsInf is not None: + if FfsInf: self.Alignment = FfsInf.__ExtendMacro__(self.Alignment) self.BuildNum = FfsInf.__ExtendMacro__(self.BuildNum) self.StringData = FfsInf.__ExtendMacro__(self.StringData) self.FileName = FfsInf.__ExtendMacro__(self.FileName) OutputFile = os.path.join(OutputPath, - ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION')) + ModuleName + SUP_MODULE_SEC + SecNum + SectionSuffix.get('VERSION')) OutputFile = os.path.normpath(OutputFile) # Get String Data StringData = '' - if self.StringData is not None: + if self.StringData: StringData = self.StringData - elif self.FileName is not None: + elif self.FileName: FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName) FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict) FileObj = open(FileNameStr, 'r') StringData = FileObj.read() StringData = '"' + StringData + '"' FileObj.close() - else: - StringData = '' GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION', Ver=StringData, BuildNumber=self.BuildNum, IsMakefile=IsMakefile) OutputFileList = [] -- cgit v1.2.3