Revert BaseTools: PYTHON3 migration
This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52..
678f851312
.
Python3 migration is the fundamental change. It requires every developer
to install Python3. Before this migration, the well communication and wide
verification must be done. But now, most people is not aware of this change,
and not try it. So, Python3 migration is reverted and be moved to edk2-staging
Python3 branch for the edk2 user evaluation.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -166,7 +166,7 @@ class StructurePcd(PcdClassObject):
|
||||
expressions = []
|
||||
if Packages is None:
|
||||
Packages = []
|
||||
super().__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
|
||||
super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
|
||||
self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None else StructuredPcdIncludeFile
|
||||
self.PackageDecs = Packages
|
||||
self.DefaultStoreName = [default_store]
|
||||
@ -242,7 +242,7 @@ class StructurePcd(PcdClassObject):
|
||||
self.PcdFieldValueFromComm = PcdObject.PcdFieldValueFromComm if PcdObject.PcdFieldValueFromComm else self.PcdFieldValueFromComm
|
||||
self.PcdFieldValueFromFdf = PcdObject.PcdFieldValueFromFdf if PcdObject.PcdFieldValueFromFdf else self.PcdFieldValueFromFdf
|
||||
|
||||
LibraryClassObject = namedtuple('LibraryClassObject', ['LibraryClass','SupModList'])
|
||||
LibraryClassObject = namedtuple('LibraryClassObject', ['LibraryClass','SupModList'], verbose=False)
|
||||
|
||||
## ModuleBuildClassObject
|
||||
#
|
||||
|
@ -17,6 +17,8 @@
|
||||
# This class is used to retrieve information stored in database and convert them
|
||||
# into PlatformBuildClassObject form for easier use for AutoGen.
|
||||
#
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
from Common.StringUtils import *
|
||||
from Common.DataType import *
|
||||
from Common.Misc import *
|
||||
@ -128,16 +130,9 @@ def GetDependencyList(FileStack, SearchPathList):
|
||||
|
||||
if len(FileContent) == 0:
|
||||
continue
|
||||
IncludedFileList = []
|
||||
|
||||
if FileContent[0] == 0xff or FileContent[0] == 0xfe:
|
||||
FileContent = str(FileContent, "utf-16")
|
||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
||||
else:
|
||||
try:
|
||||
FileContent = str(FileContent, "utf-8")
|
||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
||||
except:
|
||||
pass
|
||||
FileContent = unicode(FileContent, "utf-16")
|
||||
IncludedFileList = gIncludePattern.findall(FileContent)
|
||||
|
||||
for Inc in IncludedFileList:
|
||||
@ -937,8 +932,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
EdkLogger.error('build', FORMAT_INVALID, ErrStr, File=self.MetaFile, Line=LineNo,
|
||||
ExtraData="%s.%s" % (TokenSpaceGuid, PcdCName))
|
||||
if PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE):
|
||||
if self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() in TAB_PCD_NUMERIC_TYPES_VOID \
|
||||
and self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() != ValueList[1].strip():
|
||||
if self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() != ValueList[1].strip():
|
||||
EdkLogger.error('build', FORMAT_INVALID, "Pcd datumtype used in DSC file is not the same as its declaration in DEC file.", File=self.MetaFile, Line=LineNo,
|
||||
ExtraData="%s.%s|%s" % (TokenSpaceGuid, PcdCName, Setting))
|
||||
if (TokenSpaceGuid + '.' + PcdCName) in GlobalData.gPlatformPcds:
|
||||
@ -1552,7 +1546,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
|
||||
del pcd.SkuInfoList[TAB_COMMON]
|
||||
|
||||
list(map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType]))
|
||||
map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType])
|
||||
return Pcds
|
||||
|
||||
## Retrieve non-dynamic PCD settings
|
||||
@ -1602,7 +1596,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
else:
|
||||
PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, DatumType, MaxDatumSize)}
|
||||
|
||||
for ((PcdCName, TokenSpaceGuid), PcdSetting) in PcdValueDict.items():
|
||||
for ((PcdCName, TokenSpaceGuid), PcdSetting) in PcdValueDict.iteritems():
|
||||
if self.SkuIdMgr.SystemSkuId in PcdSetting:
|
||||
PcdValue, DatumType, MaxDatumSize = PcdSetting[self.SkuIdMgr.SystemSkuId]
|
||||
elif TAB_DEFAULT in PcdSetting:
|
||||
@ -1663,7 +1657,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
except:
|
||||
EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s' % Command)
|
||||
Result = Process.communicate()
|
||||
return Process.returncode, Result[0].decode(encoding='utf-8', errors='ignore'), Result[1].decode(encoding='utf-8', errors='ignore')
|
||||
return Process.returncode, Result[0], Result[1]
|
||||
|
||||
@staticmethod
|
||||
def IntToCString(Value, ValueSize):
|
||||
@ -2506,7 +2500,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
|
||||
del pcd.SkuInfoList[TAB_COMMON]
|
||||
|
||||
list(map(self.FilterSkuSettings, Pcds.values()))
|
||||
map(self.FilterSkuSettings, Pcds.values())
|
||||
|
||||
return Pcds
|
||||
|
||||
@ -2571,7 +2565,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
PcdObj.SkuInfoList[skuname].SkuId = skuid
|
||||
PcdObj.SkuInfoList[skuname].SkuIdName = skuname
|
||||
if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
|
||||
PcdObj.DefaultValue = list(PcdObj.SkuInfoList.values())[0].HiiDefaultValue if self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.SINGLE else PcdObj.SkuInfoList[TAB_DEFAULT].HiiDefaultValue
|
||||
PcdObj.DefaultValue = PcdObj.SkuInfoList.values()[0].HiiDefaultValue if self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.SINGLE else PcdObj.SkuInfoList[TAB_DEFAULT].HiiDefaultValue
|
||||
Pcds[PcdCName, TokenSpaceGuid]= PcdObj
|
||||
return Pcds
|
||||
## Retrieve dynamic HII PCD settings
|
||||
@ -2692,7 +2686,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
|
||||
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][DefaultStore] = DefaultValue
|
||||
for pcd in Pcds.values():
|
||||
SkuInfoObj = list(pcd.SkuInfoList.values())[0]
|
||||
SkuInfoObj = pcd.SkuInfoList.values()[0]
|
||||
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
|
||||
pcd.DatumType = pcdDecObject.DatumType
|
||||
# Only fix the value while no value provided in DSC file.
|
||||
@ -2732,7 +2726,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
invalidpcd = ",".join(invalidhii)
|
||||
EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message='The same HII PCD must map to the same EFI variable for all SKUs', File=self.MetaFile, ExtraData=invalidpcd)
|
||||
|
||||
list(map(self.FilterSkuSettings, Pcds.values()))
|
||||
map(self.FilterSkuSettings, Pcds.values())
|
||||
|
||||
return Pcds
|
||||
|
||||
@ -2830,7 +2824,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
|
||||
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = InitialValue
|
||||
for pcd in Pcds.values():
|
||||
SkuInfoObj = list(pcd.SkuInfoList.values())[0]
|
||||
SkuInfoObj = pcd.SkuInfoList.values()[0]
|
||||
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
|
||||
pcd.DatumType = pcdDecObject.DatumType
|
||||
# Only fix the value while no value provided in DSC file.
|
||||
@ -2848,7 +2842,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||
del pcd.SkuInfoList[TAB_COMMON]
|
||||
|
||||
|
||||
list(map(self.FilterSkuSettings, Pcds.values()))
|
||||
map(self.FilterSkuSettings, Pcds.values())
|
||||
return Pcds
|
||||
|
||||
## Add external modules
|
||||
|
@ -12,6 +12,7 @@
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
from Common.DataType import *
|
||||
from Common.Misc import *
|
||||
from Common.caching import cached_property, cached_class_function
|
||||
|
@ -22,7 +22,7 @@ from CommonDataClass.DataClass import FileClass
|
||||
|
||||
## Convert to SQL required string format
|
||||
def ConvertToSqlString(StringList):
|
||||
return list(map(lambda s: "'" + s.replace("'", "''") + "'", StringList))
|
||||
return map(lambda s: "'" + s.replace("'", "''") + "'", StringList)
|
||||
|
||||
## TableFile
|
||||
#
|
||||
|
@ -15,6 +15,8 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import Common.LongFilePathOs as os
|
||||
import re
|
||||
import time
|
||||
@ -139,7 +141,7 @@ class MetaFileParser(object):
|
||||
if FilePath in Class.MetaFiles:
|
||||
return Class.MetaFiles[FilePath]
|
||||
else:
|
||||
ParserObject = super().__new__(Class)
|
||||
ParserObject = super(MetaFileParser, Class).__new__(Class)
|
||||
Class.MetaFiles[FilePath] = ParserObject
|
||||
return ParserObject
|
||||
|
||||
@ -1931,10 +1933,10 @@ class DecParser(MetaFileParser):
|
||||
return
|
||||
|
||||
if self._include_flag:
|
||||
self._ValueList[1] = "<HeaderFiles>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
|
||||
self._ValueList[1] = "<HeaderFiles>_" + md5(self._CurrentLine).hexdigest()
|
||||
self._ValueList[2] = self._CurrentLine
|
||||
if self._package_flag and "}" != self._CurrentLine:
|
||||
self._ValueList[1] = "<Packages>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()
|
||||
self._ValueList[1] = "<Packages>_" + md5(self._CurrentLine).hexdigest()
|
||||
self._ValueList[2] = self._CurrentLine
|
||||
if self._CurrentLine == "}":
|
||||
self._package_flag = False
|
||||
|
@ -14,6 +14,7 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
from __future__ import absolute_import
|
||||
import uuid
|
||||
|
||||
import Common.EdkLogger as EdkLogger
|
||||
|
@ -11,6 +11,7 @@
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
from collections import OrderedDict, defaultdict
|
||||
from Common.DataType import SUP_MODULE_USER_DEFINED
|
||||
from .BuildClassObject import LibraryClassObject
|
||||
@ -22,7 +23,7 @@ from Common.BuildToolError import BUILD_ERROR
|
||||
|
||||
class OrderedListDict(OrderedDict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
super(OrderedListDict, self).__init__(*args, **kwargs)
|
||||
self.default_factory = list
|
||||
|
||||
def __missing__(self, key):
|
||||
|
@ -15,6 +15,7 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
from __future__ import absolute_import
|
||||
import sqlite3
|
||||
from Common.StringUtils import *
|
||||
from Common.DataType import *
|
||||
@ -164,7 +165,7 @@ class WorkspaceDatabase(object):
|
||||
os.remove(DbPath)
|
||||
|
||||
# create db with optimized parameters
|
||||
self.Conn = sqlite3.connect(DbPath, isolation_level=None)
|
||||
self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')
|
||||
self.Conn.execute("PRAGMA synchronous=OFF")
|
||||
self.Conn.execute("PRAGMA temp_store=MEMORY")
|
||||
self.Conn.execute("PRAGMA count_changes=OFF")
|
||||
|
Reference in New Issue
Block a user