* [patch 1/3] BaseTools/UPT: Use a simple way to get package path
@ 2017-04-01 5:33 hesschen
2017-04-01 5:33 ` [patch 2/3] BaseTools/UPT: Support Unicode path hesschen
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: hesschen @ 2017-04-01 5:33 UTC (permalink / raw)
To: edk2-devel
Instead of parsing all content of DEC file, just get the package
path only to save time.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
.../Source/Python/UPT/Core/DependencyRules.py | 56 ++++++++++++++--------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/BaseTools/Source/Python/UPT/Core/DependencyRules.py b/BaseTools/Source/Python/UPT/Core/DependencyRules.py
index 7039a7d..57f7b40 100644
--- a/BaseTools/Source/Python/UPT/Core/DependencyRules.py
+++ b/BaseTools/Source/Python/UPT/Core/DependencyRules.py
@@ -1,7 +1,7 @@
## @file
# This file is for installed package information database operations
#
-# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -21,14 +21,15 @@ Dependency
# Import Modules
#
from os.path import dirname
+import os
import Logger.Log as Logger
from Logger import StringTable as ST
from Library.Parsing import GetWorkspacePackage
from Library.Parsing import GetWorkspaceModule
+from Library.Parsing import GetPkgInfoFromDec
from Library.Misc import GetRelativePath
from Library import GlobalData
-from PomAdapter.InfPomAlignment import InfPomAlignment
from Logger.ToolError import FatalError
from Logger.ToolError import EDK1_INF_ERROR
from Logger.ToolError import UNKNOWN_ERROR
@@ -373,14 +374,11 @@ class DependencyRules(object):
# True: module doesn't depend on package in DpPackagePathList
#
def VerifyRemoveModuleDep(Path, DpPackagePathList):
- WorkSP = GlobalData.gWORKSPACE
-
try:
- PomAli = InfPomAlignment(Path, WorkSP, Skip=True)
-
- for Item in PomAli.GetPackageDependencyList():
- if Item.GetPackageFilePath() in DpPackagePathList:
- Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, Item.GetPackageFilePath()))
+ for Item in GetPackagePath(Path):
+ if Item in DpPackagePathList:
+ DecPath = os.path.normpath(os.path.join(GlobalData.gWORKSPACE, Item))
+ Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, DecPath))
return False
else:
return True
@@ -392,6 +390,30 @@ def VerifyRemoveModuleDep(Path, DpPackagePathList):
else:
return True
+# # GetPackagePath
+#
+# Get Dependency package path from an Inf file path
+#
+def GetPackagePath(InfPath):
+ PackagePath = []
+ if os.path.exists(InfPath):
+ FindSection = False
+ for Line in open(InfPath).readlines():
+ Line = Line.strip()
+ if not Line:
+ continue
+ if Line.startswith('#'):
+ continue
+ if Line.startswith('[Packages') and Line.endswith(']'):
+ FindSection = True
+ continue
+ if Line.startswith('[') and Line.endswith(']') and FindSection:
+ break
+ if FindSection:
+ PackagePath.append(os.path.normpath(Line))
+
+ return PackagePath
+
## check whether module depends on packages in DpPackagePathList and can not be satisfied by OtherPkgList
#
# @param Path: a module path
@@ -402,16 +424,13 @@ def VerifyRemoveModuleDep(Path, DpPackagePathList):
# but can be satisfied by OtherPkgList
#
def VerifyReplaceModuleDep(Path, DpPackagePathList, OtherPkgList):
- WorkSP = GlobalData.gWORKSPACE
-
try:
- PomAli = InfPomAlignment(Path, WorkSP, Skip=True)
-
- for Item in PomAli.GetPackageDependencyList():
- if Item.GetPackageFilePath() in DpPackagePathList:
- Guid, Version = Item.GetGuid(), Item.GetVersion()
+ for Item in GetPackagePath(Path):
+ if Item in DpPackagePathList:
+ DecPath = os.path.normpath(os.path.join(GlobalData.gWORKSPACE, Item))
+ Name, Guid, Version = GetPkgInfoFromDec(DecPath)
if (Guid, Version) not in OtherPkgList:
- Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, Item.GetPackageFilePath()))
+ Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, DecPath))
return False
else:
return True
@@ -422,6 +441,3 @@ def VerifyReplaceModuleDep(Path, DpPackagePathList, OtherPkgList):
return True
else:
return True
-
-
-
--
2.7.2.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 2/3] BaseTools/UPT: Support Unicode path
2017-04-01 5:33 [patch 1/3] BaseTools/UPT: Use a simple way to get package path hesschen
@ 2017-04-01 5:33 ` hesschen
2017-04-05 2:23 ` Zhu, Yonghong
2017-04-01 5:33 ` [patch 3/3] BaseTools/UPT: Fix a parser issue hesschen
2017-04-05 2:23 ` [patch 1/3] BaseTools/UPT: Use a simple way to get package path Zhu, Yonghong
2 siblings, 1 reply; 6+ messages in thread
From: hesschen @ 2017-04-01 5:33 UTC (permalink / raw)
To: edk2-devel
Update the IpiDb.py to support Unicode path for localization
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
BaseTools/Source/Python/UPT/Core/IpiDb.py | 8 ++++----
BaseTools/Source/Python/UPT/UPT.py | 7 ++++++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/UPT/Core/IpiDb.py b/BaseTools/Source/Python/UPT/Core/IpiDb.py
index 2c444f9..f147963 100644
--- a/BaseTools/Source/Python/UPT/Core/IpiDb.py
+++ b/BaseTools/Source/Python/UPT/Core/IpiDb.py
@@ -1,7 +1,7 @@
## @file
# This file is for installed package information database operations
#
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -44,7 +44,7 @@ class IpiDatabase(object):
Dir = os.path.dirname(DbPath)
if not os.path.isdir(Dir):
os.mkdir(Dir)
- self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')
+ self.Conn = sqlite3.connect(unicode(DbPath), isolation_level='DEFERRED')
self.Conn.execute("PRAGMA page_size=4096")
self.Conn.execute("PRAGMA synchronous=OFF")
self.Cur = self.Conn.cursor()
@@ -614,8 +614,8 @@ class IpiDatabase(object):
# @param DistributionFile: Distribution File
#
def GetDpByName(self, DistributionFile):
- SqlCommand = """select * from %s where NewPkgFileName like '%s'""" % \
- (self.DpTable, '%' + DistributionFile)
+ SqlCommand = """select * from %s where NewPkgFileName = '%s'""" % \
+ (self.DpTable, DistributionFile)
self.Cur.execute(SqlCommand)
for Result in self.Cur:
diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/UPT/UPT.py
index 873492d..d98b469 100644
--- a/BaseTools/Source/Python/UPT/UPT.py
+++ b/BaseTools/Source/Python/UPT/UPT.py
@@ -19,8 +19,13 @@ UPT
## import modules
#
-from Core import FileHook
+import locale
import sys
+encoding = locale.getdefaultlocale()[1]
+if encoding:
+ reload(sys)
+ sys.setdefaultencoding(encoding)
+from Core import FileHook
import os.path
from sys import platform
import platform as pf
--
2.7.2.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 2/3] BaseTools/UPT: Support Unicode path
2017-04-01 5:33 ` [patch 2/3] BaseTools/UPT: Support Unicode path hesschen
@ 2017-04-05 2:23 ` Zhu, Yonghong
0 siblings, 0 replies; 6+ messages in thread
From: Zhu, Yonghong @ 2017-04-05 2:23 UTC (permalink / raw)
To: Chen, Hesheng, edk2-devel@lists.01.org
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Chen, Hesheng
Sent: Saturday, April 1, 2017 1:33 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch 2/3] BaseTools/UPT: Support Unicode path
Update the IpiDb.py to support Unicode path for localization
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
BaseTools/Source/Python/UPT/Core/IpiDb.py | 8 ++++----
BaseTools/Source/Python/UPT/UPT.py | 7 ++++++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/UPT/Core/IpiDb.py b/BaseTools/Source/Python/UPT/Core/IpiDb.py
index 2c444f9..f147963 100644
--- a/BaseTools/Source/Python/UPT/Core/IpiDb.py
+++ b/BaseTools/Source/Python/UPT/Core/IpiDb.py
@@ -1,7 +1,7 @@
## @file
# This file is for installed package information database operations # -# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights
+reserved.<BR>
#
# This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -44,7 +44,7 @@ class IpiDatabase(object):
Dir = os.path.dirname(DbPath)
if not os.path.isdir(Dir):
os.mkdir(Dir)
- self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')
+ self.Conn = sqlite3.connect(unicode(DbPath),
+ isolation_level='DEFERRED')
self.Conn.execute("PRAGMA page_size=4096")
self.Conn.execute("PRAGMA synchronous=OFF")
self.Cur = self.Conn.cursor()
@@ -614,8 +614,8 @@ class IpiDatabase(object):
# @param DistributionFile: Distribution File
#
def GetDpByName(self, DistributionFile):
- SqlCommand = """select * from %s where NewPkgFileName like '%s'""" % \
- (self.DpTable, '%' + DistributionFile)
+ SqlCommand = """select * from %s where NewPkgFileName = '%s'""" % \
+ (self.DpTable, DistributionFile)
self.Cur.execute(SqlCommand)
for Result in self.Cur:
diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/UPT/UPT.py
index 873492d..d98b469 100644
--- a/BaseTools/Source/Python/UPT/UPT.py
+++ b/BaseTools/Source/Python/UPT/UPT.py
@@ -19,8 +19,13 @@ UPT
## import modules
#
-from Core import FileHook
+import locale
import sys
+encoding = locale.getdefaultlocale()[1] if encoding:
+ reload(sys)
+ sys.setdefaultencoding(encoding)
+from Core import FileHook
import os.path
from sys import platform
import platform as pf
--
2.7.2.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 3/3] BaseTools/UPT: Fix a parser issue
2017-04-01 5:33 [patch 1/3] BaseTools/UPT: Use a simple way to get package path hesschen
2017-04-01 5:33 ` [patch 2/3] BaseTools/UPT: Support Unicode path hesschen
@ 2017-04-01 5:33 ` hesschen
2017-04-05 2:23 ` Zhu, Yonghong
2017-04-05 2:23 ` [patch 1/3] BaseTools/UPT: Use a simple way to get package path Zhu, Yonghong
2 siblings, 1 reply; 6+ messages in thread
From: hesschen @ 2017-04-01 5:33 UTC (permalink / raw)
To: edk2-devel
Update the method to get PCD information and support empty section.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 5 +++--
BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py | 13 ++++---------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index bb8a120..a376f56 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -568,8 +568,9 @@ def GenUserExtensions(ModuleObject):
if UserExtension.GetIdentifier() == 'Depex':
continue
Statement = UserExtension.GetStatement()
- if not Statement:
- continue
+# Comment the code to support user extension without any statement just the section header in []
+# if not Statement:
+# continue
ArchList = UserExtension.GetSupArchList()
for Index in xrange(0, len(ArchList)):
ArchList[Index] = ConvertArchForInstall(ArchList[Index])
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
index 0a8624c..3c6c9ee 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
@@ -2,7 +2,7 @@
#
# This file contained the miscellaneous routines for GenMetaFile usage.
#
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -108,33 +108,28 @@ def ObtainPcdName(Packages, TokenSpaceGuidValue, Token):
TokenSpaceGuidName = ''
PcdCName = ''
TokenSpaceGuidNameFound = False
- PcdCNameFound = False
#
# Get TokenSpaceGuidCName from Guids section
#
for GuidKey in DecGuidsDict:
GuidList = DecGuidsDict[GuidKey]
- if TokenSpaceGuidNameFound:
- break
for GuidItem in GuidList:
if TokenSpaceGuidValue.upper() == GuidItem.GuidString.upper():
TokenSpaceGuidName = GuidItem.GuidCName
TokenSpaceGuidNameFound = True
break
-
+ if TokenSpaceGuidNameFound:
+ break
#
# Retrieve PcdCName from Pcds Section
#
for PcdKey in DecPcdsDict:
PcdList = DecPcdsDict[PcdKey]
- if PcdCNameFound:
- return TokenSpaceGuidName, PcdCName
for PcdItem in PcdList:
if TokenSpaceGuidName == PcdItem.TokenSpaceGuidCName and Token == PcdItem.TokenValue:
PcdCName = PcdItem.TokenCName
- PcdCNameFound = True
- break
+ return TokenSpaceGuidName, PcdCName
return TokenSpaceGuidName, PcdCName
--
2.7.2.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 3/3] BaseTools/UPT: Fix a parser issue
2017-04-01 5:33 ` [patch 3/3] BaseTools/UPT: Fix a parser issue hesschen
@ 2017-04-05 2:23 ` Zhu, Yonghong
0 siblings, 0 replies; 6+ messages in thread
From: Zhu, Yonghong @ 2017-04-05 2:23 UTC (permalink / raw)
To: Chen, Hesheng, edk2-devel@lists.01.org
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Chen, Hesheng
Sent: Saturday, April 1, 2017 1:33 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch 3/3] BaseTools/UPT: Fix a parser issue
Update the method to get PCD information and support empty section.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 5 +++--
BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py | 13 ++++---------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index bb8a120..a376f56 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -568,8 +568,9 @@ def GenUserExtensions(ModuleObject):
if UserExtension.GetIdentifier() == 'Depex':
continue
Statement = UserExtension.GetStatement()
- if not Statement:
- continue
+# Comment the code to support user extension without any statement just the section header in []
+# if not Statement:
+# continue
ArchList = UserExtension.GetSupArchList()
for Index in xrange(0, len(ArchList)):
ArchList[Index] = ConvertArchForInstall(ArchList[Index])
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
index 0a8624c..3c6c9ee 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py
@@ -2,7 +2,7 @@
#
# This file contained the miscellaneous routines for GenMetaFile usage.
#
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights
+reserved.<BR>
#
# This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -108,33 +108,28 @@ def ObtainPcdName(Packages, TokenSpaceGuidValue, Token):
TokenSpaceGuidName = ''
PcdCName = ''
TokenSpaceGuidNameFound = False
- PcdCNameFound = False
#
# Get TokenSpaceGuidCName from Guids section
#
for GuidKey in DecGuidsDict:
GuidList = DecGuidsDict[GuidKey]
- if TokenSpaceGuidNameFound:
- break
for GuidItem in GuidList:
if TokenSpaceGuidValue.upper() == GuidItem.GuidString.upper():
TokenSpaceGuidName = GuidItem.GuidCName
TokenSpaceGuidNameFound = True
break
-
+ if TokenSpaceGuidNameFound:
+ break
#
# Retrieve PcdCName from Pcds Section
#
for PcdKey in DecPcdsDict:
PcdList = DecPcdsDict[PcdKey]
- if PcdCNameFound:
- return TokenSpaceGuidName, PcdCName
for PcdItem in PcdList:
if TokenSpaceGuidName == PcdItem.TokenSpaceGuidCName and Token == PcdItem.TokenValue:
PcdCName = PcdItem.TokenCName
- PcdCNameFound = True
- break
+ return TokenSpaceGuidName, PcdCName
return TokenSpaceGuidName, PcdCName
--
2.7.2.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 1/3] BaseTools/UPT: Use a simple way to get package path
2017-04-01 5:33 [patch 1/3] BaseTools/UPT: Use a simple way to get package path hesschen
2017-04-01 5:33 ` [patch 2/3] BaseTools/UPT: Support Unicode path hesschen
2017-04-01 5:33 ` [patch 3/3] BaseTools/UPT: Fix a parser issue hesschen
@ 2017-04-05 2:23 ` Zhu, Yonghong
2 siblings, 0 replies; 6+ messages in thread
From: Zhu, Yonghong @ 2017-04-05 2:23 UTC (permalink / raw)
To: Chen, Hesheng, edk2-devel@lists.01.org
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Chen, Hesheng
Sent: Saturday, April 1, 2017 1:33 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch 1/3] BaseTools/UPT: Use a simple way to get package path
Instead of parsing all content of DEC file, just get the package path only to save time.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
.../Source/Python/UPT/Core/DependencyRules.py | 56 ++++++++++++++--------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/BaseTools/Source/Python/UPT/Core/DependencyRules.py b/BaseTools/Source/Python/UPT/Core/DependencyRules.py
index 7039a7d..57f7b40 100644
--- a/BaseTools/Source/Python/UPT/Core/DependencyRules.py
+++ b/BaseTools/Source/Python/UPT/Core/DependencyRules.py
@@ -1,7 +1,7 @@
## @file
# This file is for installed package information database operations # -# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights
+reserved.<BR>
#
# This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -21,14 +21,15 @@ Dependency # Import Modules # from os.path import dirname
+import os
import Logger.Log as Logger
from Logger import StringTable as ST
from Library.Parsing import GetWorkspacePackage
from Library.Parsing import GetWorkspaceModule
+from Library.Parsing import GetPkgInfoFromDec
from Library.Misc import GetRelativePath
from Library import GlobalData
-from PomAdapter.InfPomAlignment import InfPomAlignment
from Logger.ToolError import FatalError
from Logger.ToolError import EDK1_INF_ERROR
from Logger.ToolError import UNKNOWN_ERROR
@@ -373,14 +374,11 @@ class DependencyRules(object):
# True: module doesn't depend on package in DpPackagePathList
#
def VerifyRemoveModuleDep(Path, DpPackagePathList):
- WorkSP = GlobalData.gWORKSPACE
-
try:
- PomAli = InfPomAlignment(Path, WorkSP, Skip=True)
-
- for Item in PomAli.GetPackageDependencyList():
- if Item.GetPackageFilePath() in DpPackagePathList:
- Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, Item.GetPackageFilePath()))
+ for Item in GetPackagePath(Path):
+ if Item in DpPackagePathList:
+ DecPath = os.path.normpath(os.path.join(GlobalData.gWORKSPACE, Item))
+ Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, DecPath))
return False
else:
return True
@@ -392,6 +390,30 @@ def VerifyRemoveModuleDep(Path, DpPackagePathList):
else:
return True
+# # GetPackagePath
+#
+# Get Dependency package path from an Inf file path
+#
+def GetPackagePath(InfPath):
+ PackagePath = []
+ if os.path.exists(InfPath):
+ FindSection = False
+ for Line in open(InfPath).readlines():
+ Line = Line.strip()
+ if not Line:
+ continue
+ if Line.startswith('#'):
+ continue
+ if Line.startswith('[Packages') and Line.endswith(']'):
+ FindSection = True
+ continue
+ if Line.startswith('[') and Line.endswith(']') and FindSection:
+ break
+ if FindSection:
+ PackagePath.append(os.path.normpath(Line))
+
+ return PackagePath
+
## check whether module depends on packages in DpPackagePathList and can not be satisfied by OtherPkgList
#
# @param Path: a module path
@@ -402,16 +424,13 @@ def VerifyRemoveModuleDep(Path, DpPackagePathList):
# but can be satisfied by OtherPkgList
#
def VerifyReplaceModuleDep(Path, DpPackagePathList, OtherPkgList):
- WorkSP = GlobalData.gWORKSPACE
-
try:
- PomAli = InfPomAlignment(Path, WorkSP, Skip=True)
-
- for Item in PomAli.GetPackageDependencyList():
- if Item.GetPackageFilePath() in DpPackagePathList:
- Guid, Version = Item.GetGuid(), Item.GetVersion()
+ for Item in GetPackagePath(Path):
+ if Item in DpPackagePathList:
+ DecPath = os.path.normpath(os.path.join(GlobalData.gWORKSPACE, Item))
+ Name, Guid, Version = GetPkgInfoFromDec(DecPath)
if (Guid, Version) not in OtherPkgList:
- Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, Item.GetPackageFilePath()))
+ Logger.Info(ST.MSG_MODULE_DEPEND_ON % (Path, DecPath))
return False
else:
return True
@@ -422,6 +441,3 @@ def VerifyReplaceModuleDep(Path, DpPackagePathList, OtherPkgList):
return True
else:
return True
-
-
-
--
2.7.2.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-04-05 2:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-01 5:33 [patch 1/3] BaseTools/UPT: Use a simple way to get package path hesschen
2017-04-01 5:33 ` [patch 2/3] BaseTools/UPT: Support Unicode path hesschen
2017-04-05 2:23 ` Zhu, Yonghong
2017-04-01 5:33 ` [patch 3/3] BaseTools/UPT: Fix a parser issue hesschen
2017-04-05 2:23 ` Zhu, Yonghong
2017-04-05 2:23 ` [patch 1/3] BaseTools/UPT: Use a simple way to get package path Zhu, Yonghong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox