Re: [edk2] [PATCH] BaseTools:Function application error

2019-02-14 Thread Carsey, Jaben
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-boun...@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 
> 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 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] BaseTools:Function application error

2019-02-14 Thread Fan, ZhijuX
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 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 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