From nobody Mon Dec 23 18:31:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1516337034494847.7587821778462; Thu, 18 Jan 2018 20:43:54 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 34376222DDC1A; Thu, 18 Jan 2018 20:38:27 -0800 (PST) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (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 2C999222DDC1A for ; Thu, 18 Jan 2018 20:38:25 -0800 (PST) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Fri, 19 Jan 2018 05:43:44 +0100 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org From: Gary Lin To: edk2-devel@lists.01.org Date: Fri, 19 Jan 2018 12:43:05 +0800 Message-Id: <20180119044316.4713-5-glin@suse.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180119044316.4713-1-glin@suse.com> References: <20180119044316.4713-1-glin@suse.com> Subject: [edk2] [PATCH 04/15] BaseTools: Use the python3-range functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Replace xrange() and range() with the newer range() function Based on "futurize -f libfuturize.fixes.fix_xrange_with_import" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu Cc: Liming Gao Signed-off-by: Gary Lin --- BaseTools/Scripts/BinToPcd.py | = 3 ++- BaseTools/Scripts/ConvertMasmToNasm.py | = 1 + BaseTools/Scripts/PatchCheck.py | = 5 +++-- BaseTools/Source/Python/AutoGen/AutoGen.py | = 1 + BaseTools/Source/Python/AutoGen/BuildEngine.py | = 1 + BaseTools/Source/Python/AutoGen/GenC.py | = 1 + BaseTools/Source/Python/AutoGen/GenPcdDb.py | 2= 3 ++++++++++---------- BaseTools/Source/Python/AutoGen/GenVar.py | = 1 + BaseTools/Source/Python/AutoGen/InfSectionParser.py | = 1 + BaseTools/Source/Python/AutoGen/StrGather.py | = 1 + BaseTools/Source/Python/AutoGen/UniClassObject.py | = 1 + BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py | = 1 + BaseTools/Source/Python/BPDG/GenVpd.py | = 7 +++--- BaseTools/Source/Python/Common/DscClassObject.py | = 1 + BaseTools/Source/Python/Common/Expression.py | = 1 + BaseTools/Source/Python/Common/FdfClassObject.py | = 1 + BaseTools/Source/Python/Common/MigrationUtilities.py | = 1 + BaseTools/Source/Python/Common/Misc.py | = 3 ++- BaseTools/Source/Python/Common/Parsing.py | = 1 + BaseTools/Source/Python/Common/RangeExpression.py | = 1 + BaseTools/Source/Python/Common/String.py | = 1 + BaseTools/Source/Python/Common/ToolDefClassObject.py | = 1 + BaseTools/Source/Python/Ecc/Check.py | = 1 + BaseTools/Source/Python/Ecc/MetaDataParser.py | = 3 ++- BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | = 1 + BaseTools/Source/Python/Eot/FvImage.py | = 1 + BaseTools/Source/Python/Eot/InfParserLite.py | = 1 + BaseTools/Source/Python/GenFds/AprioriSection.py | = 1 + BaseTools/Source/Python/GenFds/FfsFileStatement.py | = 1 + BaseTools/Source/Python/GenFds/Fv.py | = 1 + BaseTools/Source/Python/GenFds/GenFds.py | = 1 + BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | = 1 + BaseTools/Source/Python/GenFds/Region.py | = 3 ++- BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py | = 1 + BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py | = 3 ++- BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py | = 3 ++- BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | = 3 ++- BaseTools/Source/Python/Trim/Trim.py | = 1 + BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | = 5 +++-- BaseTools/Source/Python/UPT/Library/CommentParsing.py | = 3 ++- BaseTools/Source/Python/UPT/Library/Misc.py | = 5 +++-- BaseTools/Source/Python/UPT/Library/Parsing.py | = 3 ++- BaseTools/Source/Python/UPT/Library/String.py | = 1 + BaseTools/Source/Python/UPT/Library/UniClassObject.py | = 3 ++- BaseTools/Source/Python/UPT/Parser/DecParserMisc.py | = 1 + BaseTools/Source/Python/UPT/Parser/InfSectionParser.py | = 3 ++- BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py | = 1 + BaseTools/Source/Python/UPT/UPT.py | = 1 + BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py | = 1 + BaseTools/Source/Python/UPT/Xml/IniToXml.py | = 1 + BaseTools/Source/Python/UPT/Xml/XmlParser.py | = 1 + BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py | = 3 ++- BaseTools/Source/Python/Workspace/DscBuildData.py | = 1 + BaseTools/Source/Python/Workspace/InfBuildData.py | = 1 + BaseTools/Source/Python/Workspace/MetaFileParser.py | = 1 + BaseTools/Tests/TestTools.py | = 3 ++- BaseTools/Tests/TianoCompress.py | = 1 + BaseTools/gcc/mingw-gcc-build.py | = 1 + 58 files changed, 91 insertions(+), 33 deletions(-) diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py index 1867f35e148e..7d8cd0a5cc25 100644 --- a/BaseTools/Scripts/BinToPcd.py +++ b/BaseTools/Scripts/BinToPcd.py @@ -16,6 +16,7 @@ BinToPcd ''' from __future__ import print_function =20 +from builtins import range import sys import argparse import re @@ -84,7 +85,7 @@ if __name__ =3D=3D '__main__': help =3D "Increase output messages") parser.add_argument("-q", "--quiet", dest =3D 'Quiet', action =3D "store= _true", help =3D "Reduce output messages") - parser.add_argument("--debug", dest =3D 'Debug', type =3D int, metavar = =3D '[0-9]', choices =3D range(0,10), default =3D 0, + parser.add_argument("--debug", dest =3D 'Debug', type =3D int, metavar = =3D '[0-9]', choices =3D list(range(0,10)), default =3D 0, help =3D "Set debug level") =20 # diff --git a/BaseTools/Scripts/ConvertMasmToNasm.py b/BaseTools/Scripts/Con= vertMasmToNasm.py index 5b83724b3124..e7b5b096fccc 100755 --- a/BaseTools/Scripts/ConvertMasmToNasm.py +++ b/BaseTools/Scripts/ConvertMasmToNasm.py @@ -17,6 +17,7 @@ from __future__ import print_function # # Import Modules # +from builtins import range import argparse import io import os.path diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 43bfc2495c6b..51d4adf08b60 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -15,6 +15,7 @@ =20 from __future__ import print_function =20 +from builtins import range VersionNumber =3D '0.1' __copyright__ =3D "Copyright (c) 2015 - 2016, Intel Corporation All right= s reserved." =20 @@ -26,7 +27,7 @@ import subprocess import sys =20 class Verbose: - SILENT, ONELINE, NORMAL =3D range(3) + SILENT, ONELINE, NORMAL =3D list(range(3)) level =3D NORMAL =20 class CommitMessageCheck: @@ -234,7 +235,7 @@ class CommitMessageCheck: break last_sig_line =3D line.strip() =20 -(START, PRE_PATCH, PATCH) =3D range(3) +(START, PRE_PATCH, PATCH) =3D list(range(3)) =20 class GitDiffCheck: """Checks the contents of a git diff.""" diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 7b9054b73b51..35c7a10de84b 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -14,6 +14,7 @@ ## Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import re import os.path as path diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Sou= rce/Python/AutoGen/BuildEngine.py index f0a973c9f197..e8f6788cdc40 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -15,6 +15,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import re import copy diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index b8ba687bcda0..d68160deb4a1 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -13,6 +13,7 @@ =20 ## Import Modules # +from builtins import range import string import collections import struct diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index 22283ef7fe23..875ee5895fd9 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -10,6 +10,7 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # +from builtins import range from StringIO import StringIO from Common.Misc import * from Common.String import StringToArray @@ -297,7 +298,7 @@ class DbItemList: # Variable length, need to calculate one by one # assert(Index < len(self.RawDataList)) - for ItemIndex in xrange(Index): + for ItemIndex in range(Index): Offset +=3D len(self.RawDataList[ItemIndex]) else: for Datas in self.RawDataList: @@ -394,7 +395,7 @@ class DbComItemList (DbItemList): assert(False) else: assert(Index < len(self.RawDataList)) - for ItemIndex in xrange(Index): + for ItemIndex in range(Index): Offset +=3D len(self.RawDataList[ItemIndex]) * self.ItemSi= ze =20 =20 return Offset @@ -478,7 +479,7 @@ class DbStringHeadTableItemList(DbItemList): # Variable length, need to calculate one by one # assert(Index < len(self.RawDataList)) - for ItemIndex in xrange(Index): + for ItemIndex in range(Index): Offset +=3D len(self.RawDataList[ItemIndex]) else: for innerIndex in range(Index): @@ -568,14 +569,14 @@ class DbStringItemList (DbComItemList): assert(len(RawDataList) =3D=3D len(LenList)) DataList =3D [] # adjust DataList according to the LenList - for Index in xrange(len(RawDataList)): + for Index in range(len(RawDataList)): Len =3D LenList[Index] RawDatas =3D RawDataList[Index] assert(Len >=3D len(RawDatas)) ActualDatas =3D [] - for i in xrange(len(RawDatas)): + for i in range(len(RawDatas)): ActualDatas.append(RawDatas[i]) - for i in xrange(len(RawDatas), Len): + for i in range(len(RawDatas), Len): ActualDatas.append(0) DataList.append(ActualDatas) self.LenList =3D LenList @@ -584,7 +585,7 @@ class DbStringItemList (DbComItemList): Offset =3D 0 =20 assert(Index < len(self.LenList)) - for ItemIndex in xrange(Index): + for ItemIndex in range(Index): Offset +=3D self.LenList[ItemIndex] =20 return Offset @@ -772,7 +773,7 @@ def BuildExDataBase(Dict): =20 # Get offset of SkuId table in the database=20 SkuIdTableOffset =3D FixedHeaderLen - for DbIndex in xrange(len(DbTotal)): + for DbIndex in range(len(DbTotal)): if DbTotal[DbIndex] is SkuidValue: break SkuIdTableOffset +=3D DbItemTotal[DbIndex].GetListSize() @@ -784,7 +785,7 @@ def BuildExDataBase(Dict): for (LocalTokenNumberTableIndex, (Offset, Table)) in enumerate(LocalTo= kenNumberTable): DbIndex =3D 0 DbOffset =3D FixedHeaderLen - for DbIndex in xrange(len(DbTotal)): + for DbIndex in range(len(DbTotal)): if DbTotal[DbIndex] is Table: DbOffset +=3D DbItemTotal[DbIndex].GetInterOffset(Offset) break @@ -810,7 +811,7 @@ def BuildExDataBase(Dict): (VariableHeadGuidIndex, VariableHeadStringIndex, SKUVariableOf= fset, VariableOffset, VariableRefTable, VariableAttribute) =3D VariableEntr= yPerSku[:] DbIndex =3D 0 DbOffset =3D FixedHeaderLen - for DbIndex in xrange(len(DbTotal)): + for DbIndex in range(len(DbTotal)): if DbTotal[DbIndex] is VariableRefTable: DbOffset +=3D DbItemTotal[DbIndex].GetInterOffset(Vari= ableOffset) break @@ -830,7 +831,7 @@ def BuildExDataBase(Dict): =20 # calculate various table offset now DbTotalLength =3D FixedHeaderLen - for DbIndex in xrange(len(DbItemTotal)): + for DbIndex in range(len(DbItemTotal)): if DbItemTotal[DbIndex] is DbLocalTokenNumberTable: LocalTokenNumberTableOffset =3D DbTotalLength elif DbItemTotal[DbIndex] is DbExMapTable: diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/P= ython/AutoGen/GenVar.py index 65d0bea36c58..d668c1edadbb 100644 --- a/BaseTools/Source/Python/AutoGen/GenVar.py +++ b/BaseTools/Source/Python/AutoGen/GenVar.py @@ -14,6 +14,7 @@ # # # Import Modules # +from builtins import range from struct import pack,unpack import collections import copy diff --git a/BaseTools/Source/Python/AutoGen/InfSectionParser.py b/BaseTool= s/Source/Python/AutoGen/InfSectionParser.py index cdc9e5e8a849..ee2aae3b70e0 100644 --- a/BaseTools/Source/Python/AutoGen/InfSectionParser.py +++ b/BaseTools/Source/Python/AutoGen/InfSectionParser.py @@ -14,6 +14,7 @@ ## Import Modules # =20 +from builtins import range import Common.EdkLogger as EdkLogger from Common.BuildToolError import * from Common.DataType import * diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Sourc= e/Python/AutoGen/StrGather.py index ed33554cd7d2..718cd60514b4 100644 --- a/BaseTools/Source/Python/AutoGen/StrGather.py +++ b/BaseTools/Source/Python/AutoGen/StrGather.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import re import Common.EdkLogger as EdkLogger from Common.BuildToolError import * diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/= Source/Python/AutoGen/UniClassObject.py index 264cf1546566..cab7623bc4e6 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -17,6 +17,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os, codecs, re import distutils.util import Common.EdkLogger as EdkLogger diff --git a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py b/B= aseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py index 53da9b881f25..ff355d05d79f 100644 --- a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py +++ b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py @@ -15,6 +15,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import os from Common.RangeExpression import RangeExpression from Common.Misc import * diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Pyth= on/BPDG/GenVpd.py index 9861e7da68f1..33b62011b9d0 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. # =20 +from builtins import range import Common.LongFilePathOs as os import StringIO import StringTable as st @@ -225,7 +226,7 @@ class PcdEntry: =20 ReturnArray =3D array.array('B') =20 - for Index in xrange(len(ValueList)): + for Index in range(len(ValueList)): Value =3D None if ValueList[Index].lower().startswith('0x'): # translate hex value @@ -251,7 +252,7 @@ class PcdEntry: =20 ReturnArray.append(Value) =20 - for Index in xrange(len(ValueList), Size): + for Index in range(len(ValueList), Size): ReturnArray.append(0) =20 self.PcdValue =3D ReturnArray.tolist() @@ -285,7 +286,7 @@ class PcdEntry: "Invalid unicode character %s in unicode s= tring %s(File: %s Line: %s)" % \ (Value, UnicodeString, self.FileName, self= .Lineno)) =20 - for Index in xrange(len(UnicodeString) * 2, Size): + for Index in range(len(UnicodeString) * 2, Size): ReturnArray.append(0) =20 self.PcdValue =3D ReturnArray.tolist() diff --git a/BaseTools/Source/Python/Common/DscClassObject.py b/BaseTools/S= ource/Python/Common/DscClassObject.py index 3a27fbffc934..f42d247cad33 100644 --- a/BaseTools/Source/Python/Common/DscClassObject.py +++ b/BaseTools/Source/Python/Common/DscClassObject.py @@ -15,6 +15,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import EdkLogger as EdkLogger import Database diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 80e527dd3688..4b66307b7eb3 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -13,6 +13,7 @@ ## Import Modules # from __future__ import print_function +from builtins import range from Common.GlobalData import * from CommonDataClass.Exceptions import BadExpression from CommonDataClass.Exceptions import WrnExpression diff --git a/BaseTools/Source/Python/Common/FdfClassObject.py b/BaseTools/S= ource/Python/Common/FdfClassObject.py index 3e7d44954c88..7ec0235967b2 100644 --- a/BaseTools/Source/Python/Common/FdfClassObject.py +++ b/BaseTools/Source/Python/Common/FdfClassObject.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range from FdfParserLite import FdfParser from Table.TableFdf import TableFdf from CommonDataClass.DataClass import MODEL_FILE_FDF, MODEL_PCD, MODEL_MET= A_DATA_COMPONENT diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseToo= ls/Source/Python/Common/MigrationUtilities.py index e9f1cabcb794..2385988247d4 100644 --- a/BaseTools/Source/Python/Common/MigrationUtilities.py +++ b/BaseTools/Source/Python/Common/MigrationUtilities.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os import re import EdkLogger diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 223dc7971b0d..49522474b36f 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os import sys import string @@ -1883,7 +1884,7 @@ def SplitOption(OptionString): def CommonPath(PathList): P1 =3D min(PathList).split(os.path.sep) P2 =3D max(PathList).split(os.path.sep) - for Index in xrange(min(len(P1), len(P2))): + for Index in range(min(len(P1), len(P2))): if P1[Index] !=3D P2[Index]: return os.path.sep.join(P1[:Index]) return os.path.sep.join(P1) diff --git a/BaseTools/Source/Python/Common/Parsing.py b/BaseTools/Source/P= ython/Common/Parsing.py index 584fc7f3c3a0..9caa9424d8ed 100644 --- a/BaseTools/Source/Python/Common/Parsing.py +++ b/BaseTools/Source/Python/Common/Parsing.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range from String import * from CommonDataClass.DataClass import * from DataType import * diff --git a/BaseTools/Source/Python/Common/RangeExpression.py b/BaseTools/= Source/Python/Common/RangeExpression.py index ee33ae3d3266..4357f240f423 100644 --- a/BaseTools/Source/Python/Common/RangeExpression.py +++ b/BaseTools/Source/Python/Common/RangeExpression.py @@ -13,6 +13,7 @@ # # Import Modules # from __future__ import print_function +from builtins import range from Common.GlobalData import * from CommonDataClass.Exceptions import BadExpression from CommonDataClass.Exceptions import WrnExpression diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Py= thon/Common/String.py index 4a8c03e88e28..e6c7a3b74ee1 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import re import DataType import Common.LongFilePathOs as os diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseToo= ls/Source/Python/Common/ToolDefClassObject.py index dc90b4783f2f..6dab179efc01 100644 --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os import re import EdkLogger diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index 5864758950ce..92259999853c 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -10,6 +10,7 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # +from builtins import range import Common.LongFilePathOs as os import re from CommonDataClass.DataClass import * diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Sour= ce/Python/Ecc/MetaDataParser.py index 82ede3eb330c..9b8b96aa4b43 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 +from builtins import range import Common.LongFilePathOs as os from CommonDataClass.DataClass import * from EccToolError import * @@ -112,7 +113,7 @@ def ParseHeaderCommentSection(CommentList, FileName =3D= None): # Last =3D 0 HeaderCommentStage =3D HEADER_COMMENT_NOT_STARTED - for Index in xrange(len(CommentList)-1, 0, -1): + for Index in range(len(CommentList)-1, 0, -1): Line =3D CommentList[Index][0] if _IsCopyrightLine(Line): Last =3D Index diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.p= y b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 2fef87c4180a..e04b67732141 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os import re import time diff --git a/BaseTools/Source/Python/Eot/FvImage.py b/BaseTools/Source/Pyth= on/Eot/FvImage.py index 9d8f0864dc41..64a27217e4a8 100644 --- a/BaseTools/Source/Python/Eot/FvImage.py +++ b/BaseTools/Source/Python/Eot/FvImage.py @@ -14,6 +14,7 @@ ## Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import re import sys diff --git a/BaseTools/Source/Python/Eot/InfParserLite.py b/BaseTools/Sourc= e/Python/Eot/InfParserLite.py index f624837f2587..4bdd60a6f71c 100644 --- a/BaseTools/Source/Python/Eot/InfParserLite.py +++ b/BaseTools/Source/Python/Eot/InfParserLite.py @@ -15,6 +15,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import Common.EdkLogger as EdkLogger from Common.DataType import * diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseTools/S= ource/Python/GenFds/AprioriSection.py index 70e2e5a3baf2..27fe2619a35f 100644 --- a/BaseTools/Source/Python/GenFds/AprioriSection.py +++ b/BaseTools/Source/Python/GenFds/AprioriSection.py @@ -15,6 +15,7 @@ ## # Import Modules # +from builtins import range from struct import * import Common.LongFilePathOs as os import StringIO diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools= /Source/Python/GenFds/FfsFileStatement.py index 12ec95b56501..cbfea730ef18 100644 --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py @@ -15,6 +15,7 @@ ## # Import Modules # +from builtins import range import Ffs import Rule import Common.LongFilePathOs as os diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python= /GenFds/Fv.py index be8b885d069e..615d9e39faf1 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -15,6 +15,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os import subprocess import StringIO diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index b2cc25d46cbc..bc7ef6408509 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -16,6 +16,7 @@ # Import Modules # from __future__ import print_function +from builtins import range from optparse import OptionParser import sys import Common.LongFilePathOs as os diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index 969f9f2e2137..6807ffdd6c3a 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -16,6 +16,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import sys import subprocess diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Py= thon/GenFds/Region.py index c946758cf549..5b9b203cf475 100644 --- a/BaseTools/Source/Python/GenFds/Region.py +++ b/BaseTools/Source/Python/GenFds/Region.py @@ -15,6 +15,7 @@ ## # Import Modules # +from builtins import range from struct import * from GenFdsGlobalVariable import GenFdsGlobalVariable import StringIO @@ -56,7 +57,7 @@ class Region(RegionClassObject): PadByte =3D pack('B', 0xFF) else: PadByte =3D pack('B', 0) - PadData =3D ''.join(PadByte for i in xrange(0, Size)) + PadData =3D ''.join(PadByte for i in range(0, Size)) Buffer.write(PadData) =20 ## AddToBuffer() diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseT= ools/Source/Python/PatchPcdValue/PatchPcdValue.py index 882da81930da..9bb4d43a969f 100644 --- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py +++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os from Common.LongFilePathSupport import OpenLongFilePath as open import sys diff --git a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py b/BaseTools/Sou= rce/Python/Pkcs7Sign/Pkcs7Sign.py index 11d11700ed99..becf3e8eb9e8 100644 --- a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py +++ b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py @@ -21,6 +21,7 @@ Pkcs7Sign ''' from __future__ import print_function =20 +from builtins import range import os import sys import argparse @@ -88,7 +89,7 @@ if __name__ =3D=3D '__main__': parser.add_argument("--signature-size", dest=3D'SignatureSizeStr', type= =3Dstr, help=3D"specify the signature size for decode process.") parser.add_argument("-v", "--verbose", dest=3D'Verbose', action=3D"store= _true", help=3D"increase output messages") parser.add_argument("-q", "--quiet", dest=3D'Quiet', action=3D"store_tru= e", help=3D"reduce output messages") - parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'[0= -9]', choices=3Drange(0,10), default=3D0, help=3D"set debug level") + parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'[0= -9]', choices=3Dlist(range(0,10)), default=3D0, help=3D"set debug level") parser.add_argument(metavar=3D"input_file", dest=3D'InputFile', type=3Da= rgparse.FileType('rb'), help=3D"specify the input filename") =20 # diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Generat= eKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateK= eys.py index 2aa6877c92be..1641968ace0e 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py @@ -24,6 +24,7 @@ Rsa2048Sha256GenerateKeys ''' from __future__ import print_function =20 +from builtins import range import os import sys import argparse=20 @@ -51,7 +52,7 @@ if __name__ =3D=3D '__main__': parser.add_argument("--public-key-hash-c", dest=3D'PublicKeyHashCFile', = type=3Dargparse.FileType('wb'), help=3D"specify the public key hash filenam= e that is SHA 256 hash of 2048 bit RSA public key in C structure format") parser.add_argument("-v", "--verbose", dest=3D'Verbose', action=3D"store= _true", help=3D"increase output messages") parser.add_argument("-q", "--quiet", dest=3D'Quiet', action=3D"store_tru= e", help=3D"reduce output messages") - parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'[0= -9]', choices=3Drange(0,10), default=3D0, help=3D"set debug level") + parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'[0= -9]', choices=3Dlist(range(0,10)), default=3D0, help=3D"set debug level") =20 # # Parse command line arguments diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py= b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py index 8c235ae51e7e..2a19ad973b91 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py @@ -19,6 +19,7 @@ Rsa2048Sha256Sign ''' from __future__ import print_function =20 +from builtins import range import os import sys import argparse=20 @@ -71,7 +72,7 @@ if __name__ =3D=3D '__main__': parser.add_argument("--private-key", dest=3D'PrivateKeyFile', type=3Darg= parse.FileType('rb'), help=3D"specify the private key filename. If not spe= cified, a test signing key is used.") parser.add_argument("-v", "--verbose", dest=3D'Verbose', action=3D"store= _true", help=3D"increase output messages") parser.add_argument("-q", "--quiet", dest=3D'Quiet', action=3D"store_tru= e", help=3D"reduce output messages") - parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'[0= -9]', choices=3Drange(0,10), default=3D0, help=3D"set debug level") + parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'[0= -9]', choices=3Dlist(range(0,10)), default=3D0, help=3D"set debug level") parser.add_argument(metavar=3D"input_file", dest=3D'InputFile', type=3Da= rgparse.FileType('rb'), help=3D"specify the input filename") =20 # diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python= /Trim/Trim.py index 05ba86262133..94f6b1bc707a 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -14,6 +14,7 @@ ## # Import Modules # +from builtins import range import Common.LongFilePathOs as os import sys import re diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTo= ols/Source/Python/UPT/GenMetaFile/GenInfFile.py index d7eaf3ea1d12..517f2a6cdecd 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py @@ -15,6 +15,7 @@ ''' GenInf ''' +from builtins import range import os import stat import codecs @@ -409,7 +410,7 @@ def GenLibraryClasses(ModuleObject): Statement +=3D '|' + FFE ModuleList =3D LibraryClass.GetSupModuleList() ArchList =3D LibraryClass.GetSupArchList() - for Index in xrange(0, len(ArchList)): + for Index in range(0, len(ArchList)): ArchList[Index] =3D ConvertArchForInstall(ArchList[Index]) ArchList.sort() SortedArch =3D ' '.join(ArchList) @@ -574,7 +575,7 @@ def GenUserExtensions(ModuleObject): # if not Statement: # continue ArchList =3D UserExtension.GetSupArchList() - for Index in xrange(0, len(ArchList)): + for Index in range(0, len(ArchList)): ArchList[Index] =3D ConvertArchForInstall(ArchList[Index]) ArchList.sort() KeyList =3D [] diff --git a/BaseTools/Source/Python/UPT/Library/CommentParsing.py b/BaseTo= ols/Source/Python/UPT/Library/CommentParsing.py index 9cd7b60e16ab..b97a051137e1 100644 --- a/BaseTools/Source/Python/UPT/Library/CommentParsing.py +++ b/BaseTools/Source/Python/UPT/Library/CommentParsing.py @@ -19,6 +19,7 @@ CommentParsing ## # Import Modules # +from builtins import range import re =20 from Library.String import GetSplitValueList @@ -74,7 +75,7 @@ def ParseHeaderCommentSection(CommentList, FileName =3D N= one, IsBinaryHeader =3D Fal # first find the last copyright line # Last =3D 0 - for Index in xrange(len(CommentList)-1, 0, -1): + for Index in range(len(CommentList)-1, 0, -1): Line =3D CommentList[Index][0] if _IsCopyrightLine(Line): Last =3D Index diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source= /Python/UPT/Library/Misc.py index 0d92cb3767c6..24e0a20daf87 100644 --- a/BaseTools/Source/Python/UPT/Library/Misc.py +++ b/BaseTools/Source/Python/UPT/Library/Misc.py @@ -19,6 +19,7 @@ Misc ## # Import Modules # +from builtins import range import os.path from os import access from os import F_OK @@ -437,7 +438,7 @@ class Sdict(IterableUserDict): def CommonPath(PathList): Path1 =3D min(PathList).split(os.path.sep) Path2 =3D max(PathList).split(os.path.sep) - for Index in xrange(min(len(Path1), len(Path2))): + for Index in range(min(len(Path1), len(Path2))): if Path1[Index] !=3D Path2[Index]: return os.path.sep.join(Path1[:Index]) return os.path.sep.join(Path1) @@ -890,7 +891,7 @@ def ProcessEdkComment(LineList): if FindEdkBlockComment: if FirstPos =3D=3D -1: FirstPos =3D StartPos - for Index in xrange(StartPos, EndPos+1): + for Index in range(StartPos, EndPos+1): LineList[Index] =3D '' FindEdkBlockComment =3D False elif Line.find("//") !=3D -1 and not Line.startswith("#"): diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py b/BaseTools/Sou= rce/Python/UPT/Library/Parsing.py index c34e7751442a..bac664506f4d 100644 --- a/BaseTools/Source/Python/UPT/Library/Parsing.py +++ b/BaseTools/Source/Python/UPT/Library/Parsing.py @@ -20,6 +20,7 @@ Parsing ## # Import Modules # +from builtins import range import os.path import re =20 @@ -973,7 +974,7 @@ def GenSection(SectionName, SectionDict, SplitArch=3DTr= ue, NeedBlankLine=3DFalse): ArchList =3D GetSplitValueList(SectionAttrs, DataType.= TAB_COMMENT_SPLIT) else: ArchList =3D [SectionAttrs] - for Index in xrange(0, len(ArchList)): + for Index in range(0, len(ArchList)): ArchList[Index] =3D ConvertArchForInstall(ArchList[Index]) Section =3D '[' + SectionName + '.' + (', ' + SectionName + '.= ').join(ArchList) + ']' else: diff --git a/BaseTools/Source/Python/UPT/Library/String.py b/BaseTools/Sour= ce/Python/UPT/Library/String.py index 278073e4a379..2f916324bd13 100644 --- a/BaseTools/Source/Python/UPT/Library/String.py +++ b/BaseTools/Source/Python/UPT/Library/String.py @@ -18,6 +18,7 @@ String ## # Import Modules # +from builtins import range import re import os.path from string import strip diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTo= ols/Source/Python/UPT/Library/UniClassObject.py index 84958ae38cef..d07c26abd9c2 100644 --- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py +++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py @@ -19,6 +19,7 @@ from __future__ import print_function ## # Import Modules # +from builtins import range import os, codecs, re import distutils.util from Logger import ToolError @@ -515,7 +516,7 @@ class UniFileClassObject(object): FileIn[LineCount-1] =3D Line FileIn[LineCount] =3D '\r\n' LineCount -=3D 1 - for Index in xrange (LineCount + 1, len (FileIn) - 1): + for Index in range (LineCount + 1, len (FileIn) - 1): if (Index =3D=3D len(FileIn) -1): FileIn[Index] =3D '\r\n' else: diff --git a/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py b/BaseTool= s/Source/Python/UPT/Parser/DecParserMisc.py index 22a50680fb8f..14539b0bd6c1 100644 --- a/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py +++ b/BaseTools/Source/Python/UPT/Parser/DecParserMisc.py @@ -17,6 +17,7 @@ DecParserMisc =20 ## Import modules # +from builtins import range import os import Logger.Log as Logger from Logger.ToolError import FILE_PARSE_FAILURE diff --git a/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py b/BaseT= ools/Source/Python/UPT/Parser/InfSectionParser.py index 727164c2c244..ac821deded0a 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py +++ b/BaseTools/Source/Python/UPT/Parser/InfSectionParser.py @@ -18,6 +18,7 @@ InfSectionParser ## # Import Modules # +from builtins import range from copy import deepcopy import re =20 @@ -455,7 +456,7 @@ class InfSectionParser(InfDefinSectionParser, Arch =3D Match.groups(1)[0].upper() ArchList.append(Arch) CommentSoFar =3D '' - for Index in xrange(1, len(List)): + for Index in range(1, len(List)): Result =3D ParseComment(List[Index], DT.ALL_USAGE_TOKENS, = TokenDict, [], False) Usage =3D Result[0] Type =3D Result[1] diff --git a/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py b/Ba= seTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py index 074aa311f31d..4c28b7f5d22a 100644 --- a/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py +++ b/BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py @@ -20,6 +20,7 @@ from __future__ import print_function ## # Import Modules # +from builtins import range import os.path from os import sep import platform diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/U= PT/UPT.py index 0bfcc44e3f19..3296ee3d3d8f 100644 --- a/BaseTools/Source/Python/UPT/UPT.py +++ b/BaseTools/Source/Python/UPT/UPT.py @@ -19,6 +19,7 @@ UPT =20 ## import modules # +from builtins import range import locale import sys encoding =3D locale.getdefaultlocale()[1] diff --git a/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py b= /BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py index 626f17426de7..2c21823194e2 100644 --- a/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py +++ b/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py @@ -12,6 +12,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. =20 from __future__ import print_function +from builtins import range import os #import Object.Parser.InfObject as InfObject from Object.Parser.InfCommonObject import CurrentLine diff --git a/BaseTools/Source/Python/UPT/Xml/IniToXml.py b/BaseTools/Source= /Python/UPT/Xml/IniToXml.py index 037471056d81..79db9a31a28b 100644 --- a/BaseTools/Source/Python/UPT/Xml/IniToXml.py +++ b/BaseTools/Source/Python/UPT/Xml/IniToXml.py @@ -16,6 +16,7 @@ IniToXml ''' =20 +from builtins import range import os.path import re from time import strftime diff --git a/BaseTools/Source/Python/UPT/Xml/XmlParser.py b/BaseTools/Sourc= e/Python/UPT/Xml/XmlParser.py index 58959081d0ab..b4d52f7bdc1f 100644 --- a/BaseTools/Source/Python/UPT/Xml/XmlParser.py +++ b/BaseTools/Source/Python/UPT/Xml/XmlParser.py @@ -19,6 +19,7 @@ XmlParser ## # Import Modules # +from builtins import range import re =20 from Library.Xml.XmlRoutines import XmlNode diff --git a/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py b/BaseTools/S= ource/Python/UPT/Xml/XmlParserMisc.py index 7e3dc94edf64..28b146ff9183 100644 --- a/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py +++ b/BaseTools/Source/Python/UPT/Xml/XmlParserMisc.py @@ -15,6 +15,7 @@ ''' XmlParserMisc ''' +from builtins import range from Object.POM.CommonObject import TextObject from Logger.StringTable import ERR_XML_PARSER_REQUIRED_ITEM_MISSING from Logger.ToolError import PARSER_ERROR @@ -53,7 +54,7 @@ def ConvertVariableName(VariableName): if SecondByte !=3D 0: return None =20 - if FirstByte not in xrange(0x20, 0x7F): + if FirstByte not in range(0x20, 0x7F): return None TransferedStr +=3D ('%c')%FirstByte Index =3D Index + 2 diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 3ddbc4ca0b05..cabad879b8d2 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -18,6 +18,7 @@ # into PlatformBuildClassObject form for easier use for AutoGen. # from __future__ import print_function +from builtins import range from Common.String import * from Common.DataType import * from Common.Misc import * diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 67c08ee47841..9fc2e681b73d 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -12,6 +12,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 +from builtins import range from Common.String import * from Common.DataType import * from Common.Misc import * diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index afc8394efcf0..5128dc2a6d2f 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -16,6 +16,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import Common.LongFilePathOs as os import re import time diff --git a/BaseTools/Tests/TestTools.py b/BaseTools/Tests/TestTools.py index c52b8bd94234..1202289616ee 100644 --- a/BaseTools/Tests/TestTools.py +++ b/BaseTools/Tests/TestTools.py @@ -16,6 +16,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import base64 import os import os.path @@ -162,7 +163,7 @@ class BaseToolsTest(unittest.TestCase): if maxlen is None: maxlen =3D minlen return ''.join( [chr(random.randint(0,255)) - for x in xrange(random.randint(minlen, maxlen)) + for x in range(random.randint(minlen, maxlen)) ]) =20 def setUp(self): diff --git a/BaseTools/Tests/TianoCompress.py b/BaseTools/Tests/TianoCompre= ss.py index f6a4a6ae9c5d..65f783d1be9e 100644 --- a/BaseTools/Tests/TianoCompress.py +++ b/BaseTools/Tests/TianoCompress.py @@ -16,6 +16,7 @@ # Import Modules # from __future__ import print_function +from builtins import range import os import random import sys diff --git a/BaseTools/gcc/mingw-gcc-build.py b/BaseTools/gcc/mingw-gcc-bui= ld.py index 643fec58a457..f7d0308bd9fa 100755 --- a/BaseTools/gcc/mingw-gcc-build.py +++ b/BaseTools/gcc/mingw-gcc-build.py @@ -18,6 +18,7 @@ =20 =20 from __future__ import print_function +from builtins import range from optparse import OptionParser import os import shutil --=20 2.15.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel