All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/oe-selftest: avoid deprecated imp.reload function
@ 2017-05-02 17:37 leonardo.sandoval.gonzalez
  2017-05-04 16:41 ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: leonardo.sandoval.gonzalez @ 2017-05-02 17:37 UTC (permalink / raw)
  To: openembedded-core

From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>

As explained in [1], the module function imp.reload has been deprecated for
importlib.reload, so use the latter instead.

[1] https://docs.python.org/3/library/imp.html#imp.reload

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
---
 scripts/oe-selftest | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index 52366b1c8de..bbc161e649b 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -35,7 +35,7 @@ import time as t
 import re
 import fnmatch
 import collections
-import imp
+import importlib
 
 sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib')
 import scriptpath
@@ -497,7 +497,7 @@ def main():
     bbpath = get_bb_var('BBPATH').split(':')
     layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)]
     sys.path.extend(layer_libdirs)
-    imp.reload(oeqa.selftest)
+    importlib.reload(oeqa.selftest)
 
     # act like bitbake and enforce en_US.UTF-8 locale
     os.environ["LC_ALL"] = "en_US.UTF-8"
-- 
2.12.0



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

* Re: [PATCH] scripts/oe-selftest: avoid deprecated imp.reload function
  2017-05-02 17:37 [PATCH] scripts/oe-selftest: avoid deprecated imp.reload function leonardo.sandoval.gonzalez
@ 2017-05-04 16:41 ` Burton, Ross
  2017-05-04 17:26   ` Leonardo Sandoval
  0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2017-05-04 16:41 UTC (permalink / raw)
  To: Leonardo Sandoval; +Cc: OE-core

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

On 2 May 2017 at 18:37, <leonardo.sandoval.gonzalez@linux.intel.com> wrote:

> As explained in [1], the module function imp.reload has been deprecated for
> importlib.reload, so use the latter instead.
>

$ oe-selftest -r package
2017-05-04 17:40:10,352 - selftest - INFO - Running bitbake -e to get BBPATH
Traceback (most recent call last):
  File "/home/ross/Yocto/poky/scripts/oe-selftest", line 806, in <module>
    ret = main()
  File "/home/ross/Yocto/poky/scripts/oe-selftest", line 500, in main
    importlib.reload(oeqa.selftest)
UnboundLocalError: local variable 'importlib' referenced before assignment

Ross

[-- Attachment #2: Type: text/html, Size: 1457 bytes --]

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

* Re: [PATCH] scripts/oe-selftest: avoid deprecated imp.reload function
  2017-05-04 16:41 ` Burton, Ross
@ 2017-05-04 17:26   ` Leonardo Sandoval
  2017-05-05  9:57     ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Leonardo Sandoval @ 2017-05-04 17:26 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Thu, 2017-05-04 at 17:41 +0100, Burton, Ross wrote:
> 
> On 2 May 2017 at 18:37, <leonardo.sandoval.gonzalez@linux.intel.com>
> wrote:
>         As explained in [1], the module function imp.reload has been
>         deprecated for
>         importlib.reload, so use the latter instead.
>         
> 
> $ oe-selftest -r package
> 2017-05-04 17:40:10,352 - selftest - INFO - Running bitbake -e to get
> BBPATH
> Traceback (most recent call last):
>   File "/home/ross/Yocto/poky/scripts/oe-selftest", line 806, in
> <module>
>     ret = main()
>   File "/home/ross/Yocto/poky/scripts/oe-selftest", line 500, in main
>     importlib.reload(oeqa.selftest)
> UnboundLocalError: local variable 'importlib' referenced before
> assignment
> 
I saw the error also. The strange thing is that the import importlib has
global scope but the interpreter does not have it visible at the 'main'
function. any idea? will send a v2 once I figure out the latter.

Leo

> 
> Ross




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

* Re: [PATCH] scripts/oe-selftest: avoid deprecated imp.reload function
  2017-05-04 17:26   ` Leonardo Sandoval
@ 2017-05-05  9:57     ` Burton, Ross
  0 siblings, 0 replies; 4+ messages in thread
From: Burton, Ross @ 2017-05-05  9:57 UTC (permalink / raw)
  To: Leonardo Sandoval; +Cc: OE-core

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

On 4 May 2017 at 18:26, Leonardo Sandoval <
leonardo.sandoval.gonzalez@linux.intel.com> wrote:

> I saw the error also. The strange thing is that the import importlib has
> global scope but the interpreter does not have it visible at the 'main'
> function. any idea? will send a v2 once I figure out the latter.
>

I had a ten second look before mailing and decided that it was sufficiently
weird to let you figure it out ;)

Ross

[-- Attachment #2: Type: text/html, Size: 881 bytes --]

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

end of thread, other threads:[~2017-05-05  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02 17:37 [PATCH] scripts/oe-selftest: avoid deprecated imp.reload function leonardo.sandoval.gonzalez
2017-05-04 16:41 ` Burton, Ross
2017-05-04 17:26   ` Leonardo Sandoval
2017-05-05  9:57     ` Burton, Ross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.