From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3CC3320352138 for ; Tue, 1 May 2018 23:49:31 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 23:49:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,353,1520924400"; d="scan'208";a="36184981" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga007.fm.intel.com with ESMTP; 01 May 2018 23:49:30 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 1 May 2018 23:49:30 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.6]) with mapi id 14.03.0319.002; Wed, 2 May 2018 14:49:20 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py Thread-Index: AQHT2L+L5cAzsodcW0KvkpDtYUNq16QcEd8Q Date: Wed, 2 May 2018 06:49:19 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 May 2018 06:49:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Friday, April 20, 2018 11:52 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/MigrationUtilities.py | 568 ---------------= ----- BaseTools/Source/Python/Makefile | 1 - 2 files changed, 569 deletions(-) diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseToo= ls/Source/Python/Common/MigrationUtilities.py deleted file mode 100644 index 0c93c72a60f6..000000000000 --- a/BaseTools/Source/Python/Common/MigrationUtilities.py +++ /dev/null @@ -1,568 +0,0 @@ -## @file -# Contains several utilitities shared by migration tools. -# -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
-= # This program and the accompanying materials -# are licensed and made avai= lable under the terms and conditions of the BSD License -# which accompanie= s this distribution. The full text of the license may be found at -# http:= //opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -#= WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. -# - -## -# Import Modules -# -import Common.LongFilePathOs as os -import re -import EdkLogger -from optparse import OptionParser -from Common.BuildToolError import * -from XmlRoutines import * -from CommonDataClass.CommonClass import * -from Common.LongFilePathSupport= import OpenLongFilePath as open - -## Set all fields of CommonClass object. -# -# Set all attributes of CommonClass object from XML Dom object of XmlCommo= n. -# -# @param Common The destine CommonClass object. -# @param XmlCommon The source XML Dom object. -# -def SetCommon(Common, XmlCommon): - XmlTag =3D "Usage" - Common.Usage =3D XmlAttribute(XmlCommon, XmlTag).split() - - XmlTag =3D TAB_PCDS_FEATURE_FLAG - Common.FeatureFlag =3D XmlAttribute(XmlCommon, XmlTag) - =20 - XmlTag =3D "SupArchList" - Common.SupArchList =3D XmlAttribute(XmlCommon, XmlTag).split() - =20 - XmlTag =3D XmlNodeName(XmlCommon) + "/" + "HelpText" - Common.HelpText =3D XmlElement(XmlCommon, XmlTag) - - -## Set some fields of CommonHeaderClass object. -# -# Set Name, Guid, FileName and FullPath fields of CommonHeaderClass object= from -# XML Dom object of XmlCommonHeader, NameTag and FileName. -# -# @param CommonHeader The destine CommonClass object. -# @param XmlCommonHeader The source XML Dom object. -# @param NameTag The name tag in XML Dom object. -# @param FileName The file name of the XML file. -# -def SetIdentification(CommonHeader, XmlCommonHeader, NameTag, FileName): - XmlParentTag =3D XmlNodeName(XmlCommonHeader) - =20 - XmlTag =3D XmlParentTag + "/" + NameTag - CommonHeader.Name =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParentTag + "/" + "GuidValue" - CommonHeader.Guid =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParentTag + "/" + "Version" - CommonHeader.Version =3D XmlElement(XmlCommonHeader, XmlTag) - - CommonHeader.FileName =3D os.path.basename(FileName) - CommonHeader.FullPath =3D os.path.abspath(FileName) - - -## Regular expression to match specification and value. -mReSpecification =3D re.compile(r"(?P\w+)\s+(?P\w*)"= ) - -## Add specification to specification dictionary. -# -# Abstract specification name, value pair from Specification String and ad= d them -# to specification dictionary. -# -# @param SpecificationDict The destine Specification dictionary. -# @param SpecificationString The source Specification String from which t= he -# specification name and value pair is abstrac= ted. -# -def AddToSpecificationDict(SpecificationDict, SpecificationString): - """Abstract specification name, value pair from Specification String""= " - for SpecificationMatch in mReSpecification.finditer(SpecificationStrin= g): - Specification =3D SpecificationMatch.group("Specification") - Value =3D SpecificationMatch.group("Value") - SpecificationDict[Specification] =3D Value - -## Set all fields of CommonHeaderClass object. -# -# Set all attributes of CommonHeaderClass object from XML Dom object of -#= XmlCommonHeader, NameTag and FileName. -# -# @param CommonHeader The destine CommonClass object. -# @param XmlCommonHeader The source XML Dom object. -# @param NameTag The name tag in XML Dom object. -# @param FileName The file name of the XML file. -# -def SetCommonHeader(CommonHeader, XmlCommonHeader): - """Set all attributes of CommonHeaderClass object from XmlCommonHeader= """ - XmlParent =3D XmlNodeName(XmlCommonHeader) - =20 - XmlTag =3D XmlParent + "/" + "Abstract" - CommonHeader.Abstract =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "Description" - CommonHeader.Description =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "Copyright" - CommonHeader.Copyright =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "License" - CommonHeader.License =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "Specification" - Specification =3D XmlElement(XmlCommonHeader, XmlTag) - - AddToSpecificationDict(CommonHeader.Specification, Specification) - - XmlTag =3D XmlParent + "/" + "ModuleType" - CommonHeader.ModuleType =3D XmlElement(XmlCommonHeader, XmlTag) - - -## Load a new Cloned Record class object. -# -# Read an input XML ClonedRecord DOM object and return an object of Cloned= Record -# contained in the DOM object. -# -# @param XmlCloned A child XML DOM object in a Common XML DOM. -# -# @retvel ClonedRecord A new Cloned Record object created by XmlCl= oned. -# -def LoadClonedRecord(XmlCloned): - ClonedRecord =3D ClonedRecordClass() - - XmlTag =3D "Id" - ClonedRecord.Id =3D int(XmlAttribute(XmlCloned, XmlTag)) - - XmlTag =3D "FarGuid" - ClonedRecord.FarGuid =3D XmlAttribute(XmlCloned, XmlTag) - - XmlTag =3D "Cloned/PackageGuid" - ClonedRecord.PackageGuid =3D XmlElement(XmlCloned, XmlTag) - =20 - XmlTag =3D "Cloned/PackageVersion" - ClonedRecord.PackageVersion =3D XmlElement(XmlCloned, XmlTag) - =20 - XmlTag =3D "Cloned/ModuleGuid" - ClonedRecord.ModuleGuid =3D XmlElement(XmlCloned, XmlTag) - =20 - XmlTag =3D "Cloned/ModuleVersion" - ClonedRecord.ModuleVersion =3D XmlElement(XmlCloned, XmlTag) - =20 - return ClonedRecord - - -## Load a new Guid/Protocol/Ppi common class object. -# -# Read an input XML Guid/Protocol/Ppi DOM object and return an object of -= # Guid/Protocol/Ppi contained in the DOM object. -# -# @param XmlGuidProtocolPpiCommon A child XML DOM object in a Common XML = DOM. -# -# @retvel GuidProtocolPpiCommon A new GuidProtocolPpiCommon class objec= t -# created by XmlGuidProtocolPpiCommon. -# -def LoadGuidProtocolPpiCommon(XmlGuidProtocolPpiCommon): - GuidProtocolPpiCommon =3D GuidProtocolPpiCommonClass() - =20 - XmlTag =3D "Name" - GuidProtocolPpiCommon.Name =3D XmlAttribute(XmlGuidProtocolPpiCommon, = XmlTag) - - XmlParent =3D XmlNodeName(XmlGuidProtocolPpiCommon) - if XmlParent =3D=3D "Entry": - XmlTag =3D "%s/C_Name" % XmlParent - elif XmlParent =3D=3D "GuidCNames": - XmlTag =3D "%s/GuidCName" % XmlParent - else: - XmlTag =3D "%s/%sCName" % (XmlParent, XmlParent) - =20 - GuidProtocolPpiCommon.CName =3D XmlElement(XmlGuidProtocolPpiCommon, X= mlTag) - =20 - XmlTag =3D XmlParent + "/" + "GuidValue" - GuidProtocolPpiCommon.Guid =3D XmlElement(XmlGuidProtocolPpiCommon, Xm= lTag) - =20 - if XmlParent.endswith("Notify"): - GuidProtocolPpiCommon.Notify =3D True - - XmlTag =3D "GuidTypeList" - GuidTypes =3D XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag) - GuidProtocolPpiCommon.GuidTypeList =3D GuidTypes.split() - =20 - XmlTag =3D "SupModuleList" - SupModules =3D XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag) - GuidProtocolPpiCommon.SupModuleList =3D SupModules.split() - - SetCommon(GuidProtocolPpiCommon, XmlGuidProtocolPpiCommon) - - return GuidProtocolPpiCommon - - -## Load a new Pcd class object. -# -# Read an input XML Pcd DOM object and return an object of Pcd -# containe= d in the DOM object. -# -# @param XmlPcd A child XML DOM object in a Common XML DOM. -# -# @retvel Pcd A new Pcd object created by XmlPcd. -# -def LoadPcd(XmlPcd): - """Return a new PcdClass object equivalent to XmlPcd""" - Pcd =3D PcdClass() - - XmlTag =3D "PcdEntry/C_Name" - Pcd.CName =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/Token" - Pcd.Token =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/TokenSpaceGuidCName" - Pcd.TokenSpaceGuidCName =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/DatumType" - Pcd.DatumType =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/MaxDatumSize" - Pcd.MaxDatumSize =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/DefaultValue" - Pcd.DefaultValue =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdItemType" - Pcd.ItemType =3D XmlAttribute(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/ValidUsage" - Pcd.ValidUsage =3D XmlElement(XmlPcd, XmlTag).split() - - XmlTag =3D "SupModuleList" - Pcd.SupModuleList =3D XmlAttribute(XmlPcd, XmlTag).split() - - SetCommon(Pcd, XmlPcd) - - return Pcd - - -## Load a new LibraryClass class object. -# -# Read an input XML LibraryClass DOM object and return an object of Librar= yClass -# contained in the DOM object. -# -# @param XmlLibraryClass A child XML DOM object in a Common XML DOM. -# -# @retvel LibraryClass A new LibraryClass object created by XmlLibra= ryClass. -# -def LoadLibraryClass(XmlLibraryClass): - LibraryClass =3D LibraryClassClass() - - XmlTag =3D "LibraryClass/Keyword" - LibraryClass.LibraryClass =3D XmlElement(XmlLibraryClass, XmlTag) - if LibraryClass.LibraryClass =3D=3D "": - XmlTag =3D "Name" - LibraryClass.LibraryClass =3D XmlAttribute(XmlLibraryClass, XmlTag= ) - =20 - XmlTag =3D "LibraryClass/IncludeHeader" - LibraryClass.IncludeHeader =3D XmlElement(XmlLibraryClass, XmlTag) - =20 - XmlTag =3D "RecommendedInstanceVersion" - RecommendedInstanceVersion =3D XmlAttribute(XmlLibraryClass, XmlTag) - LibraryClass.RecommendedInstanceVersion =3D RecommendedInstanceVersion - =20 - XmlTag =3D "RecommendedInstanceGuid" - RecommendedInstanceGuid =3D XmlAttribute(XmlLibraryClass, XmlTag) - LibraryClass.RecommendedInstanceGuid =3D RecommendedInstanceGuid - =20 - XmlTag =3D "SupModuleList" - SupModules =3D XmlAttribute(XmlLibraryClass, XmlTag) - LibraryClass.SupModuleList =3D SupModules.split() - =20 - SetCommon(LibraryClass, XmlLibraryClass) - =20 - return LibraryClass - - -## Load a new Build Option class object. -# -# Read an input XML BuildOption DOM object and return an object of Build O= ption -# contained in the DOM object. -# -# @param XmlBuildOption A child XML DOM object in a Common XML DOM. -# -# @retvel BuildOption A new Build Option object created by XmlBui= ldOption. -# -def LoadBuildOption(XmlBuildOption): - """Return a new BuildOptionClass object equivalent to XmlBuildOption""= " - BuildOption =3D BuildOptionClass() - =20 - BuildOption.Option =3D XmlElementData(XmlBuildOption) - - XmlTag =3D "BuildTargets" - BuildOption.BuildTargetList =3D XmlAttribute(XmlBuildOption, XmlTag).s= plit() - =20 - XmlTag =3D "ToolChainFamily" - BuildOption.ToolChainFamily =3D XmlAttribute(XmlBuildOption, XmlTag) - =20 - XmlTag =3D "TagName" - BuildOption.TagName =3D XmlAttribute(XmlBuildOption, XmlTag) - =20 - XmlTag =3D "ToolCode" - BuildOption.ToolCode =3D XmlAttribute(XmlBuildOption, XmlTag) - =20 - XmlTag =3D "SupArchList" - BuildOption.SupArchList =3D XmlAttribute(XmlBuildOption, XmlTag).split= () - =20 - return BuildOption - - -## Load a new User Extensions class object. -# -# Read an input XML UserExtensions DOM object and return an object of User= -# Extensions contained in the DOM object. -# -# @param XmlUserExtensions A child XML DOM object in a Common XML DOM. -# -# @retvel UserExtensions A new User Extensions object created by -# XmlUserExtensions. -# -def LoadUserExtensions(XmlUserExtensions): - UserExtensions =3D UserExtensionsClass() - =20 - XmlTag =3D "UserID" - UserExtensions.UserID =3D XmlAttribute(XmlUserExtensions, XmlTag) - =20 - XmlTag =3D "Identifier" - UserExtensions.Identifier =3D XmlAttribute(XmlUserExtensions, XmlTag) - =20 - UserExtensions.Content =3D XmlElementData(XmlUserExtensions) - =20 - return UserExtensions - - -## Store content to a text file object. -# -# Write some text file content to a text file object. The contents may ech= o -# in screen in a verbose way. -# -# @param TextFile The text file object. -# @param Content The string object to be written to a text fil= e. -# -def StoreTextFile(TextFile, Content): - EdkLogger.verbose(Content) - TextFile.write(Content) - - -## Add item to a section. -# -# Add an Item with specific CPU architecture to section dictionary. -# The possible duplication is ensured to be removed. -# -# @param Section Section dictionary indexed by CPU architectur= e. -# @param Arch CPU architecture: Ia32, X64, Ipf, ARM, AARCH6= 4, Ebc or Common. -# @param Item The Item to be added to section dictionary. -# -def AddToSection(Section, Arch, Item): - SectionArch =3D Section.get(Arch, []) - if Item not in SectionArch: - SectionArch.append(Item) - Section[Arch] =3D SectionArch - - -## Get section contents. -# -# Return the content of section named SectionName. -# the contents is based on Methods and ObjectLists. -# -# @param SectionName The name of the section. -# @param Method A function returning a string item of an obje= ct. -# @param ObjectList The list of object. -# -# @retval Section The string content of a section. -# -def GetSection(SectionName, Method, ObjectList): - SupportedArches =3D ["common", "Ia32", "X64", "Ipf", "Ebc", "ARM", "AA= RCH64"] - SectionDict =3D {} - for Object in ObjectList: - Item =3D Method(Object) - if Item =3D=3D "": - continue - Item =3D " %s" % Item - Arches =3D Object.SupArchList - if len(Arches) =3D=3D 0: - AddToSection(SectionDict, "common", Item) - else: - for Arch in SupportedArches: - if Arch.upper() in Arches: - AddToSection(SectionDict, Arch, Item) - - Section =3D "" - for Arch in SupportedArches: - SectionArch =3D "\n".join(SectionDict.get(Arch, [])) - if SectionArch !=3D "": - Section +=3D "[%s.%s]\n%s\n" % (SectionName, Arch, SectionArch= ) - Section +=3D "\n" - if Section !=3D "": - Section +=3D "\n" - return Section - - -## Store file header to a text file. -# -# Write standard file header to a text file. The content includes copyrigh= t, -# abstract, description and license extracted from CommonHeader class o= bject. -# -# @param TextFile The text file object. -# @param CommonHeader The source CommonHeader class object. -# -def StoreHeader(TextFile, CommonHeader): - CopyRight =3D CommonHeader.Copyright - Abstract =3D CommonHeader.Abstract - Description =3D CommonHeader.Description - License =3D CommonHeader.License - - Header =3D "#/** @file\n#\n" - Header +=3D "# " + Abstract + "\n#\n" - Header +=3D "# " + Description.strip().replace("\n", "\n# ") + "\n" - Header +=3D "# " + CopyRight + "\n#\n" - Header +=3D "# " + License.replace("\n", "\n# ").replace(" ", " ") - Header +=3D "\n#\n#**/\n\n" - - StoreTextFile(TextFile, Header) - -## Store file header to a text file. -# -# Write Defines section to a text file. DefinesTupleList determines the co= ntent. -# -# @param TextFile The text file object. -# @param DefinesTupleList The list of (Tag, Value) to be added as one i= tem. -# -def StoreDefinesSection(TextFile, DefinesTupleList): - Section =3D "[Defines]\n" - for DefineItem in DefinesTupleList: - Section +=3D " %-30s =3D %s\n" % DefineItem - - Section +=3D "\n\n" - StoreTextFile(TextFile, Section) - - -## Return one User Extension section. -# -# Read the input UserExtentsions class object and return one section. -# -# @param UserExtensions An input UserExtensions class object. -# -# @retval UserExtensionSection A section representing UserExtensions objec= t. -# -def GetUserExtensions(UserExtensions): - UserId =3D UserExtensions.UserID - Identifier =3D UserExtensions.Identifier - Content =3D UserExtensions.Content - - return "[UserExtensions.%s.%s]\n %s\n\n" % (UserId, Identifier, Conte= nt) - -## Regular expression to match an equation. -mReEquation =3D re.compile(r"\s*(\S+)\s*=3D\s*(\S*)\s*") - -## Return a value tuple matching information in a text fle. -# -# Parse the text file and return a value tuple corresponding to an input t= ag -# tuple. In case of any error, an tuple of empty strings is returned. -# -# @param FileName The file name of the text file. -# @param TagTuple A tuple of tags as the key to the value. -# -# @param ValueTupe The returned tuple corresponding to the tag t= uple. -# -def GetTextFileInfo(FileName, TagTuple): - ValueTuple =3D [""] * len(TagTuple) - try: - for Line in open(FileName): - Line =3D Line.split("#", 1)[0] - MatchEquation =3D mReEquation.match(Line) - if MatchEquation: - Tag =3D MatchEquation.group(1).upper() - Value =3D MatchEquation.group(2) - for Index in range(len(TagTuple)): - if TagTuple[Index] =3D=3D Tag: - ValueTuple[Index] =3D Value - except: - EdkLogger.info("IO Error in reading file %s" % FileName) - =20 - return ValueTuple - - -## Return a value tuple matching information in an XML fle. -# -# Parse the XML file and return a value tuple corresponding to an input ta= g -# tuple. In case of any error, an tuple of empty strings is returned. -# -# @param FileName The file name of the XML file. -# @param TagTuple A tuple of tags as the key to the value. -# -# @param ValueTupe The returned tuple corresponding to the tag t= uple. -# -def GetXmlFileInfo(FileName, TagTuple): - XmlDom =3D XmlParseFile(FileName) - return tuple([XmlElement(XmlDom, XmlTag) for XmlTag in TagTuple]) - - -## Parse migration command line options -# -# Use standard Python module o= ptparse to parse command line option of this tool. -# -# @param Source The source file type. -# @param Destinate The destinate file type. -# -# @retval Options A optparse object containing the parsed optio= ns. -# @retval InputFile Path of an source file to be migrated. -# -def MigrationOptionParser(Source, Destinate, ToolName, VersionNumber=3D1.0= ): - # use clearer usage to override default usage message - UsageString =3D "%s [-a] [-v|-q] [-o ] " % To= olName - Version =3D "%s Version %.2f" % (ToolName, VersionNumber) - Copyright =3D "Copyright (c) 2007, Intel Corporation. All rights reser= ved." - =20 - Parser =3D OptionParser(description=3DCopyright, version=3DVersion, us= age=3DUsageString) - Parser.add_option("-o", "--output", dest=3D"OutputFile", help=3D"The n= ame of the %s file to be created." % Destinate) - Parser.add_option("-a", "--auto", dest=3D"AutoWrite", action=3D"store_= true", default=3DFalse, help=3D"Automatically create the %s file using the = name of the %s file and replacing file extension" % (Source, Destinate)) - Parser.add_option("-q", "--quiet", action=3D"store_true", type=3DNone,= help=3D"Disable all messages except FATAL ERRORS.") - Parser.add_option("-v", "--verbose", action=3D"store_true", type=3DNon= e, help=3D"Turn on verbose output with informational messages printed.") - - Options, Args =3D Parser.parse_args() - - # Set logging level - if Options.verbose: - EdkLogger.setLevel(EdkLogger.VERBOSE) - elif Options.quiet: - EdkLogger.setLevel(EdkLogger.QUIET) - else: - EdkLogger.setLevel(EdkLogger.INFO) - =20 - # error check - if len(Args) =3D=3D 0: - raise MigrationError(PARAMETER_MISSING, name=3D"Input file", usage= =3DParser.get_usage()) - if len(Args) > 1: - raise MigrationError(PARAMETER_INVALID, name=3D"Too many input fil= es", usage=3DParser.get_usage()) - - InputFile =3D Args[0] - if not os.path.exists(InputFile): - raise MigrationError(FILE_NOT_FOUND, name=3DInputFile) - - if Options.OutputFile: - if Options.AutoWrite: - raise MigrationError(OPTION_CONFLICT, arg1=3D"-o", arg2=3D"-a"= , usage=3DParser.get_usage()) - else: - if Options.AutoWrite: - Options.OutputFile =3D os.path.splitext(InputFile)[0] + "." + = Destinate.lower() - else: - raise MigrationError(OPTION_MISSING, name=3D"-o", usage=3DPars= er.get_usage()) - - return Options, InputFile - -# This acts like the main() function for the script, unless it is 'import'= ed -# into another script. -if __name__ =3D=3D '__main__': - pass diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Mak= efile index a51207d3d831..7652d2b80901 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -45,7 +45,6 @@ COMMON_PYTHON=3D$(BASE_TOOLS_PATH)\Source\Python\Common\B= uildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\LongFilePathOs.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\LongFilePathOsPath.p= y \ $(BASE_TOOLS_PATH)\Source\Python\Common\LongFilePathSupport.= py \ - $(BASE_TOOLS_PATH)\Source\Python\Common\MigrationUtilities.p= y \ $(BASE_TOOLS_PATH)\Source\Python\Common\Misc.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\Parsing.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\String.py \ -- 2.16.2.windows.1