[edk2-devel] [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8

Fan, ZhijuX posted 1 patch 1 week ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/build/BuildReport.py | 2 +-
BaseTools/Source/Python/build/build.py       | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

[edk2-devel] [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8

Posted by Fan, ZhijuX 1 week ago
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2304

build.py and BuildReport.py warning using python 3.8
SyntaxWarning: "is" with a literal. Did you mean "=="?

For comparison of two strings use "==" instead of "is"
The patch is going to fixed this issue.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Source/Python/build/BuildReport.py | 2 +-
 BaseTools/Source/Python/build/build.py       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 880459d367..8efa869162 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -2042,7 +2042,7 @@ class FdReport(object):
         self.VPDBaseAddress = 0
         self.VPDSize = 0
         for index, FdRegion in enumerate(Fd.RegionList):
-            if str(FdRegion.RegionType) is 'FILE' and Wa.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
+            if str(FdRegion.RegionType) == 'FILE' and Wa.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
                 self.VPDBaseAddress = self.FdRegionList[index].BaseAddress
                 self.VPDSize = self.FdRegionList[index].Size
                 break
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 07f1f21b5d..4b31356a42 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -2064,7 +2064,7 @@ class Build():
             if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:
                 FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
                 for FdRegion in FdDict.RegionList:
-                    if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
+                    if str(FdRegion.RegionType) == 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
                         if int(FdRegion.Offset) % 8 != 0:
                             EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))
             Wa.FdfProfile = Fdf.Profile
-- 
2.14.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51484): https://edk2.groups.io/g/devel/message/51484
Mute This Topic: https://groups.io/mt/64318144/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8

Posted by Philippe Mathieu-Daudé 1 week ago
On 11/29/19 7:08 AM, Fan, ZhijuX via Groups.Io wrote:
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2304
> 
> build.py and BuildReport.py warning using python 3.8
> SyntaxWarning: "is" with a literal. Did you mean "=="?

Maybe:

BuildReport.py warning using python 3.8:

   SyntaxWarning: "is" with a literal. Did you mean "=="?


> 
> For comparison of two strings use "==" instead of "is"
> The patch is going to fixed this issue.

Maybe:

Fix this comparison of two strings warning by using "==" instead of "is".

> 
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> ---
>   BaseTools/Source/Python/build/BuildReport.py | 2 +-
>   BaseTools/Source/Python/build/build.py       | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
> index 880459d367..8efa869162 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -2042,7 +2042,7 @@ class FdReport(object):
>           self.VPDBaseAddress = 0
>           self.VPDSize = 0
>           for index, FdRegion in enumerate(Fd.RegionList):
> -            if str(FdRegion.RegionType) is 'FILE' and Wa.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
> +            if str(FdRegion.RegionType) == 'FILE' and Wa.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
>                   self.VPDBaseAddress = self.FdRegionList[index].BaseAddress
>                   self.VPDSize = self.FdRegionList[index].Size
>                   break
> diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
> index 07f1f21b5d..4b31356a42 100755
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -2064,7 +2064,7 @@ class Build():
>               if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:
>                   FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]
>                   for FdRegion in FdDict.RegionList:
> -                    if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):
> +                    if str(FdRegion.RegionType) == 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):

This already has been fixed in commit 49fb9f7e06b92.

>                           if int(FdRegion.Offset) % 8 != 0:
>                               EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))
>               Wa.FdfProfile = Fdf.Profile
> --
> 2.14.1.windows.1
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51504): https://edk2.groups.io/g/devel/message/51504
Mute This Topic: https://groups.io/mt/64318144/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-