public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8
@ 2019-11-29  6:08 Fan, ZhijuX
  2019-11-29  9:44 ` [edk2-devel] " Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Fan, ZhijuX @ 2019-11-29  6:08 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Gao, Liming, Feng, Bob C

[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]

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


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 5812 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8
  2019-11-29  6:08 [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8 Fan, ZhijuX
@ 2019-11-29  9:44 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-29  9:44 UTC (permalink / raw)
  To: devel@edk2.groups.io, zhijux.fan@intel.com; +Cc: Gao, Liming, Feng, Bob C

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
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-29  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-29  6:08 [PATCH] BaseTools:Change judgment symbol "is" to "==" for python3.8 Fan, ZhijuX
2019-11-29  9:44 ` [edk2-devel] " Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox