* [PATCH] BaseTools:Function application error
@ 2019-02-14 9:11 Fan, ZhijuX
2019-02-14 15:30 ` Carsey, Jaben
0 siblings, 1 reply; 3+ messages in thread
From: Fan, ZhijuX @ 2019-02-14 9:11 UTC (permalink / raw)
To: edk2-devel@lists.01.org; +Cc: Gao, Liming, Feng, Bob C
Error due to incorrect function parameters and attributes
FileWrite() The first argument it needs is a list, not a file
This patch abandons this function and saves the file independently
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
BaseTools/Source/Python/Eot/EotMain.py | 5 +++--
BaseTools/Source/Python/Workspace/BuildClassObject.py | 1 +
BaseTools/Source/Python/build/BuildReport.py | 9 ++++++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/Python/Eot/EotMain.py
index fd4bee6f90..8c2bfc45e4 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -21,7 +21,7 @@ import Eot.EotGlobalData as EotGlobalData
from optparse import OptionParser
from Common.StringUtils import NormPath
from Common import BuildToolError
-from Common.Misc import GuidStructureStringToGuidString, sdict
+from Common.Misc import GuidStructureStringToGuidString
from Eot.Parser import *
from Eot.InfParserLite import EdkInfParser
from Common.StringUtils import GetSplitValueList
@@ -32,6 +32,7 @@ from Eot.Report import Report
from Common.BuildVersion import gBUILD_VERSION
from Eot.Parser import ConvertGuid
from Common.LongFilePathSupport import OpenLongFilePath as open
+import collections
import struct
import uuid
import copy
@@ -57,7 +58,7 @@ class Image(array):
self._LEN_ = None
self._OFF_ = None
- self._SubImages = sdict() # {offset: Image()}
+ self._SubImages = collections.OrderedDict() # {offset: Image()}
array.__init__(self)
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index cff77a71ae..6f8a09e87c 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -261,6 +261,7 @@ class StructurePcd(PcdClassObject):
self.PackageDecs = Packages
self.DefaultStoreName = [default_store]
self.DefaultValues = OrderedDict()
+ self.DefaultFromDSC = None
self.PcdMode = None
self.SkuOverrideValues = OrderedDict()
self.StructName = None
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 0b98d62cb6..70584570a5 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1651,14 +1651,17 @@ class PredictionReport(object):
SourceList = os.path.join(self._EotDir, "SourceFile.txt")
GuidList = os.path.join(self._EotDir, "GuidList.txt")
DispatchList = os.path.join(self._EotDir, "Dispatch.txt")
-
+ TempList = []
TempFile = open(SourceList, "w+")
for Item in self._SourceList:
- FileWrite(TempFile, Item)
+ TempList.append(Item + TAB_LINE_BREAK)
+ TempFile.writelines(TempList)
TempFile.close()
+ TempList = []
TempFile = open(GuidList, "w+")
for Key in self._GuidMap:
- FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key]))
+ TempList.append("%s %s %s" % (Key, self._GuidMap[Key], TAB_LINE_BREAK))
+ TempFile.writelines(TempList)
TempFile.close()
try:
--
2.14.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] BaseTools:Function application error
2019-02-14 9:11 [PATCH] BaseTools:Function application error Fan, ZhijuX
@ 2019-02-14 15:30 ` Carsey, Jaben
2019-02-15 0:59 ` FW: " Fan, ZhijuX
0 siblings, 1 reply; 3+ messages in thread
From: Carsey, Jaben @ 2019-02-14 15:30 UTC (permalink / raw)
To: Fan, ZhijuX, edk2-devel@lists.01.org; +Cc: Gao, Liming
I am really confused by this patch and how it ever worked.
I see that you remove the import for sdict. But I see that sdict is used in other places in that file.
I also cant find a class definition for sdict anywhere (certainly not in Common/Misc).
So maybe refactor and remove all the other uses of sdict from the file?
-Jaben
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Fan, ZhijuX
> Sent: Thursday, February 14, 2019 1:12 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [PATCH] BaseTools:Function application error
>
> Error due to incorrect function parameters and attributes
> FileWrite() The first argument it needs is a list, not a file
> This patch abandons this function and saves the file independently
>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> ---
> BaseTools/Source/Python/Eot/EotMain.py | 5 +++--
> BaseTools/Source/Python/Workspace/BuildClassObject.py | 1 +
> BaseTools/Source/Python/build/BuildReport.py | 9 ++++++---
> 3 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/BaseTools/Source/Python/Eot/EotMain.py
> b/BaseTools/Source/Python/Eot/EotMain.py
> index fd4bee6f90..8c2bfc45e4 100644
> --- a/BaseTools/Source/Python/Eot/EotMain.py
> +++ b/BaseTools/Source/Python/Eot/EotMain.py
> @@ -21,7 +21,7 @@ import Eot.EotGlobalData as EotGlobalData
> from optparse import OptionParser
> from Common.StringUtils import NormPath
> from Common import BuildToolError
> -from Common.Misc import GuidStructureStringToGuidString, sdict
> +from Common.Misc import GuidStructureStringToGuidString
> from Eot.Parser import *
> from Eot.InfParserLite import EdkInfParser
> from Common.StringUtils import GetSplitValueList
> @@ -32,6 +32,7 @@ from Eot.Report import Report
> from Common.BuildVersion import gBUILD_VERSION
> from Eot.Parser import ConvertGuid
> from Common.LongFilePathSupport import OpenLongFilePath as open
> +import collections
> import struct
> import uuid
> import copy
> @@ -57,7 +58,7 @@ class Image(array):
> self._LEN_ = None
> self._OFF_ = None
>
> - self._SubImages = sdict() # {offset: Image()}
> + self._SubImages = collections.OrderedDict() # {offset: Image()}
>
> array.__init__(self)
>
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index cff77a71ae..6f8a09e87c 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -261,6 +261,7 @@ class StructurePcd(PcdClassObject):
> self.PackageDecs = Packages
> self.DefaultStoreName = [default_store]
> self.DefaultValues = OrderedDict()
> + self.DefaultFromDSC = None
> self.PcdMode = None
> self.SkuOverrideValues = OrderedDict()
> self.StructName = None
> diff --git a/BaseTools/Source/Python/build/BuildReport.py
> b/BaseTools/Source/Python/build/BuildReport.py
> index 0b98d62cb6..70584570a5 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -1651,14 +1651,17 @@ class PredictionReport(object):
> SourceList = os.path.join(self._EotDir, "SourceFile.txt")
> GuidList = os.path.join(self._EotDir, "GuidList.txt")
> DispatchList = os.path.join(self._EotDir, "Dispatch.txt")
> -
> + TempList = []
> TempFile = open(SourceList, "w+")
> for Item in self._SourceList:
> - FileWrite(TempFile, Item)
> + TempList.append(Item + TAB_LINE_BREAK)
> + TempFile.writelines(TempList)
> TempFile.close()
> + TempList = []
> TempFile = open(GuidList, "w+")
> for Key in self._GuidMap:
> - FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key]))
> + TempList.append("%s %s %s" % (Key, self._GuidMap[Key],
> TAB_LINE_BREAK))
> + TempFile.writelines(TempList)
> TempFile.close()
>
> try:
> --
> 2.14.1.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* FW: [PATCH] BaseTools:Function application error
2019-02-14 15:30 ` Carsey, Jaben
@ 2019-02-15 0:59 ` Fan, ZhijuX
0 siblings, 0 replies; 3+ messages in thread
From: Fan, ZhijuX @ 2019-02-15 0:59 UTC (permalink / raw)
To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming
The sdict() was originally defined as common/Misc.py and UPT/library/Misc.py.
However, the sdict() defined previously in common/Misc.py has been removed.
It is not as good as the OrderedDict() when running in Python3.
Any question, please let me know. Thanks.
Best Regards
Fan Zhiju
-----Original Message-----
From: Carsey, Jaben
Sent: Thursday, February 14, 2019 11:31 PM
To: Fan, ZhijuX <zhijux.fan@intel.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: RE: [PATCH] BaseTools:Function application error
I am really confused by this patch and how it ever worked.
I see that you remove the import for sdict. But I see that sdict is used in other places in that file.
I also cant find a class definition for sdict anywhere (certainly not in Common/Misc).
So maybe refactor and remove all the other uses of sdict from the file?
-Jaben
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Fan, ZhijuX
> Sent: Thursday, February 14, 2019 1:12 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [PATCH] BaseTools:Function application error
>
> Error due to incorrect function parameters and attributes
> FileWrite() The first argument it needs is a list, not a file This
> patch abandons this function and saves the file independently
>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> ---
> BaseTools/Source/Python/Eot/EotMain.py | 5 +++--
> BaseTools/Source/Python/Workspace/BuildClassObject.py | 1 +
> BaseTools/Source/Python/build/BuildReport.py | 9 ++++++---
> 3 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/BaseTools/Source/Python/Eot/EotMain.py
> b/BaseTools/Source/Python/Eot/EotMain.py
> index fd4bee6f90..8c2bfc45e4 100644
> --- a/BaseTools/Source/Python/Eot/EotMain.py
> +++ b/BaseTools/Source/Python/Eot/EotMain.py
> @@ -21,7 +21,7 @@ import Eot.EotGlobalData as EotGlobalData from
> optparse import OptionParser from Common.StringUtils import NormPath
> from Common import BuildToolError -from Common.Misc import
> GuidStructureStringToGuidString, sdict
> +from Common.Misc import GuidStructureStringToGuidString
> from Eot.Parser import *
> from Eot.InfParserLite import EdkInfParser from Common.StringUtils
> import GetSplitValueList @@ -32,6 +32,7 @@ from Eot.Report import
> Report from Common.BuildVersion import gBUILD_VERSION from
> Eot.Parser import ConvertGuid from Common.LongFilePathSupport import
> OpenLongFilePath as open
> +import collections
> import struct
> import uuid
> import copy
> @@ -57,7 +58,7 @@ class Image(array):
> self._LEN_ = None
> self._OFF_ = None
>
> - self._SubImages = sdict() # {offset: Image()}
> + self._SubImages = collections.OrderedDict() # {offset:
> + Image()}
>
> array.__init__(self)
>
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index cff77a71ae..6f8a09e87c 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -261,6 +261,7 @@ class StructurePcd(PcdClassObject):
> self.PackageDecs = Packages
> self.DefaultStoreName = [default_store]
> self.DefaultValues = OrderedDict()
> + self.DefaultFromDSC = None
> self.PcdMode = None
> self.SkuOverrideValues = OrderedDict()
> self.StructName = None
> diff --git a/BaseTools/Source/Python/build/BuildReport.py
> b/BaseTools/Source/Python/build/BuildReport.py
> index 0b98d62cb6..70584570a5 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -1651,14 +1651,17 @@ class PredictionReport(object):
> SourceList = os.path.join(self._EotDir, "SourceFile.txt")
> GuidList = os.path.join(self._EotDir, "GuidList.txt")
> DispatchList = os.path.join(self._EotDir, "Dispatch.txt")
> -
> + TempList = []
> TempFile = open(SourceList, "w+")
> for Item in self._SourceList:
> - FileWrite(TempFile, Item)
> + TempList.append(Item + TAB_LINE_BREAK)
> + TempFile.writelines(TempList)
> TempFile.close()
> + TempList = []
> TempFile = open(GuidList, "w+")
> for Key in self._GuidMap:
> - FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key]))
> + TempList.append("%s %s %s" % (Key, self._GuidMap[Key],
> TAB_LINE_BREAK))
> + TempFile.writelines(TempList)
> TempFile.close()
>
> try:
> --
> 2.14.1.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-15 0:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-14 9:11 [PATCH] BaseTools:Function application error Fan, ZhijuX
2019-02-14 15:30 ` Carsey, Jaben
2019-02-15 0:59 ` FW: " Fan, ZhijuX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox