public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix two Python 3.8 warnings
@ 2019-12-05 11:19 Philippe Mathieu-Daudé
  2019-12-05 11:19 ` [PATCH v2 1/2] BaseTools: Avoid "is" with a literal " Philippe Mathieu-Daudé
  2019-12-05 11:19 ` [PATCH v2 2/2] .pytool: Avoid "is" with a literal Python 3.8 warnings in CI plugins Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-05 11:19 UTC (permalink / raw)
  To: devel
  Cc: Sean Brogan, Zhiju . Fan, Bret Barkelew, Bob Feng, Liming Gao,
	Michael D Kinney, Philippe Mathieu-Daude

Two other Python 3.8 fixes, similar to the one reported in BZ#2304:
https://bugzilla.tianocore.org/show_bug.cgi?id=2304

v2: addressed Bob Feng comments,
- refer BZ link
- split console output lines to pass PatchCheck.py

Regards,

Phil.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>

Philippe Mathieu-Daude (2):
  BaseTools: Avoid "is" with a literal Python 3.8 warnings
  .pytool: Avoid "is" with a literal Python 3.8 warnings in CI plugins

 .pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py   | 2 +-
 .pytool/Plugin/LibraryClassCheck/LibraryClassCheck.py | 2 +-
 BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.21.0


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

* [PATCH v2 1/2] BaseTools: Avoid "is" with a literal Python 3.8 warnings
  2019-12-05 11:19 [PATCH v2 0/2] Fix two Python 3.8 warnings Philippe Mathieu-Daudé
@ 2019-12-05 11:19 ` Philippe Mathieu-Daudé
  2019-12-05 11:19 ` [PATCH v2 2/2] .pytool: Avoid "is" with a literal Python 3.8 warnings in CI plugins Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-05 11:19 UTC (permalink / raw)
  To: devel
  Cc: Sean Brogan, Zhiju . Fan, Bret Barkelew, Bob Feng, Liming Gao,
	Michael D Kinney, Philippe Mathieu-Daude

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2304

The following statement produces a SyntaxWarning with Python 3.8:

  if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in \
    str(FdRegion.RegionDataList):
  BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py:168: SyntaxWarning: \
    "is" with a literal. Did you mean "=="?

Change the 'is' operator by the conventional '==' comparator.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
index fde48b4b2788..ec0c25bd1487 100644
--- a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
@@ -165,7 +165,7 @@ class WorkspaceAutoGen(AutoGen):
             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))
             FdfProfile = Fdf.Profile
-- 
2.21.0


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

* [PATCH v2 2/2] .pytool: Avoid "is" with a literal Python 3.8 warnings in CI plugins
  2019-12-05 11:19 [PATCH v2 0/2] Fix two Python 3.8 warnings Philippe Mathieu-Daudé
  2019-12-05 11:19 ` [PATCH v2 1/2] BaseTools: Avoid "is" with a literal " Philippe Mathieu-Daudé
@ 2019-12-05 11:19 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-05 11:19 UTC (permalink / raw)
  To: devel
  Cc: Sean Brogan, Zhiju . Fan, Bret Barkelew, Bob Feng, Liming Gao,
	Michael D Kinney, Philippe Mathieu-Daude

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2304

To avoid SyntaxWarning with Python 3.8, change the 'is' operator
by the conventional '==' comparator.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 .pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py   | 2 +-
 .pytool/Plugin/LibraryClassCheck/LibraryClassCheck.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py b/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py
index e2485f570841..9af4f72c8de3 100644
--- a/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py
+++ b/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py
@@ -61,7 +61,7 @@ class DscCompleteCheck(ICiBuildPlugin):
         abs_dsc_path = os.path.join(abs_pkg_path, pkgconfig["DscPath"].strip())
         wsr_dsc_path = Edk2pathObj.GetEdk2RelativePathFromAbsolutePath(abs_dsc_path)
 
-        if abs_dsc_path is None or wsr_dsc_path is "" or not os.path.isfile(abs_dsc_path):
+        if abs_dsc_path is None or wsr_dsc_path == "" or not os.path.isfile(abs_dsc_path):
             tc.SetSkipped()
             tc.LogStdError("Package Dsc not found")
             return 0
diff --git a/.pytool/Plugin/LibraryClassCheck/LibraryClassCheck.py b/.pytool/Plugin/LibraryClassCheck/LibraryClassCheck.py
index 5dafcbc13f8a..a62a7e912b15 100644
--- a/.pytool/Plugin/LibraryClassCheck/LibraryClassCheck.py
+++ b/.pytool/Plugin/LibraryClassCheck/LibraryClassCheck.py
@@ -67,7 +67,7 @@ class LibraryClassCheck(ICiBuildPlugin):
         abs_dec_path = self.__GetPkgDec(abs_pkg_path)
         wsr_dec_path = Edk2pathObj.GetEdk2RelativePathFromAbsolutePath(abs_dec_path)
 
-        if abs_dec_path is None or wsr_dec_path is "" or not os.path.isfile(abs_dec_path):
+        if abs_dec_path is None or wsr_dec_path == "" or not os.path.isfile(abs_dec_path):
             tc.SetSkipped()
             tc.LogStdError("No DEC file {0} in package {1}".format(abs_dec_path, abs_pkg_path))
             return -1
-- 
2.21.0


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

end of thread, other threads:[~2019-12-05 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-05 11:19 [PATCH v2 0/2] Fix two Python 3.8 warnings Philippe Mathieu-Daudé
2019-12-05 11:19 ` [PATCH v2 1/2] BaseTools: Avoid "is" with a literal " Philippe Mathieu-Daudé
2019-12-05 11:19 ` [PATCH v2 2/2] .pytool: Avoid "is" with a literal Python 3.8 warnings in CI plugins 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