[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Replace imp.reload with importlib.reload

Ashley E Desimone posted 1 patch 4 years ago
Failed in applying to current master (apply log)
edkrepo/__main__.py            | 4 ++--
edkrepo/edkrepo_cli.py         | 1 -
edkrepo/edkrepo_entry_point.py | 4 ++--
3 files changed, 4 insertions(+), 5 deletions(-)
[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Replace imp.reload with importlib.reload
Posted by Ashley E Desimone 4 years ago
The imp module is deprecated since Python 3.4 in favor
of importlib. This patch replaces uses of imp.reload()
with importlib.reload() and removes unused imp imports.

Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
---
 edkrepo/__main__.py            | 4 ++--
 edkrepo/edkrepo_cli.py         | 1 -
 edkrepo/edkrepo_entry_point.py | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/edkrepo/__main__.py b/edkrepo/__main__.py
index 115a779..2d538d3 100644
--- a/edkrepo/__main__.py
+++ b/edkrepo/__main__.py
@@ -7,7 +7,7 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
-import imp
+import importlib
 import os
 import sys
 import site
@@ -23,7 +23,7 @@ for directory in sitepackages:
         edkrepo_site_dir = edkrepo_package_path
         break
 else:
-    imp.reload(edkrepo)
+    importlib.reload(edkrepo)
 import edkrepo.edkrepo_entry_point
 
 if __name__ == '__main__':
diff --git a/edkrepo/edkrepo_cli.py b/edkrepo/edkrepo_cli.py
index 4e7ff16..1adb63f 100644
--- a/edkrepo/edkrepo_cli.py
+++ b/edkrepo/edkrepo_cli.py
@@ -18,7 +18,6 @@ import os
 import subprocess
 import site
 import inspect
-import imp
 import importlib.util
 import datetime as dt
 
diff --git a/edkrepo/edkrepo_entry_point.py b/edkrepo/edkrepo_entry_point.py
index dd2b36e..30d65ff 100644
--- a/edkrepo/edkrepo_entry_point.py
+++ b/edkrepo/edkrepo_entry_point.py
@@ -8,7 +8,7 @@
 #
 
 import argparse
-import imp
+import importlib
 import importlib.util
 import inspect
 import json
@@ -37,7 +37,7 @@ for directory in sitepackages:
         edkrepo_site_dir = edkrepo_package_path
         break
 else:
-    imp.reload(edkrepo)
+    importlib.reload(edkrepo)
     edkrepo_package_path = os.path.dirname(os.path.dirname(edkrepo.__file__))
     for directory in sitepackages:
         if edkrepo_package_path == directory:
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67331): https://edk2.groups.io/g/devel/message/67331
Mute This Topic: https://groups.io/mt/78195940/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Replace imp.reload with importlib.reload
Posted by Nate DeSimone 4 years ago
Pushed: https://github.com/tianocore/edk2-staging/commit/405bee4

> -----Original Message-----
> From: Ashley E Desimone <ashley.e.desimone@intel.com>
> Sent: Wednesday, November 11, 2020 3:42 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>;
> Agyeman, Prince <prince.agyeman@intel.com>; Bjorge, Erik C
> <erik.c.bjorge@intel.com>
> Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Replace imp.reload with
> importlib.reload
> 
> The imp module is deprecated since Python 3.4 in favor of importlib. This
> patch replaces uses of imp.reload() with importlib.reload() and removes
> unused imp imports.
> 
> Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Puja Pandya <puja.pandya@intel.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Cc: Prince Agyeman <prince.agyeman@intel.com>
> Cc: Erik Bjorge <erik.c.bjorge@intel.com>
> Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
> ---
>  edkrepo/__main__.py            | 4 ++--
>  edkrepo/edkrepo_cli.py         | 1 -
>  edkrepo/edkrepo_entry_point.py | 4 ++--
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/edkrepo/__main__.py b/edkrepo/__main__.py index
> 115a779..2d538d3 100644
> --- a/edkrepo/__main__.py
> +++ b/edkrepo/__main__.py
> @@ -7,7 +7,7 @@
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> -import imp
> +import importlib
>  import os
>  import sys
>  import site
> @@ -23,7 +23,7 @@ for directory in sitepackages:
>          edkrepo_site_dir = edkrepo_package_path
>          break
>  else:
> -    imp.reload(edkrepo)
> +    importlib.reload(edkrepo)
>  import edkrepo.edkrepo_entry_point
> 
>  if __name__ == '__main__':
> diff --git a/edkrepo/edkrepo_cli.py b/edkrepo/edkrepo_cli.py index
> 4e7ff16..1adb63f 100644
> --- a/edkrepo/edkrepo_cli.py
> +++ b/edkrepo/edkrepo_cli.py
> @@ -18,7 +18,6 @@ import os
>  import subprocess
>  import site
>  import inspect
> -import imp
>  import importlib.util
>  import datetime as dt
> 
> diff --git a/edkrepo/edkrepo_entry_point.py
> b/edkrepo/edkrepo_entry_point.py index dd2b36e..30d65ff 100644
> --- a/edkrepo/edkrepo_entry_point.py
> +++ b/edkrepo/edkrepo_entry_point.py
> @@ -8,7 +8,7 @@
>  #
> 
>  import argparse
> -import imp
> +import importlib
>  import importlib.util
>  import inspect
>  import json
> @@ -37,7 +37,7 @@ for directory in sitepackages:
>          edkrepo_site_dir = edkrepo_package_path
>          break
>  else:
> -    imp.reload(edkrepo)
> +    importlib.reload(edkrepo)
>      edkrepo_package_path =
> os.path.dirname(os.path.dirname(edkrepo.__file__))
>      for directory in sitepackages:
>          if edkrepo_package_path == directory:
> --
> 2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67582): https://edk2.groups.io/g/devel/message/67582
Mute This Topic: https://groups.io/mt/78195940/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Replace imp.reload with importlib.reload
Posted by Nate DeSimone 4 years ago
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Ashley E Desimone <ashley.e.desimone@intel.com>
> Sent: Wednesday, November 11, 2020 3:42 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>;
> Agyeman, Prince <prince.agyeman@intel.com>; Bjorge, Erik C
> <erik.c.bjorge@intel.com>
> Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Replace imp.reload with
> importlib.reload
> 
> The imp module is deprecated since Python 3.4 in favor of importlib. This
> patch replaces uses of imp.reload() with importlib.reload() and removes
> unused imp imports.
> 
> Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Puja Pandya <puja.pandya@intel.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Cc: Prince Agyeman <prince.agyeman@intel.com>
> Cc: Erik Bjorge <erik.c.bjorge@intel.com>
> Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
> ---
>  edkrepo/__main__.py            | 4 ++--
>  edkrepo/edkrepo_cli.py         | 1 -
>  edkrepo/edkrepo_entry_point.py | 4 ++--
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/edkrepo/__main__.py b/edkrepo/__main__.py index
> 115a779..2d538d3 100644
> --- a/edkrepo/__main__.py
> +++ b/edkrepo/__main__.py
> @@ -7,7 +7,7 @@
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> -import imp
> +import importlib
>  import os
>  import sys
>  import site
> @@ -23,7 +23,7 @@ for directory in sitepackages:
>          edkrepo_site_dir = edkrepo_package_path
>          break
>  else:
> -    imp.reload(edkrepo)
> +    importlib.reload(edkrepo)
>  import edkrepo.edkrepo_entry_point
> 
>  if __name__ == '__main__':
> diff --git a/edkrepo/edkrepo_cli.py b/edkrepo/edkrepo_cli.py index
> 4e7ff16..1adb63f 100644
> --- a/edkrepo/edkrepo_cli.py
> +++ b/edkrepo/edkrepo_cli.py
> @@ -18,7 +18,6 @@ import os
>  import subprocess
>  import site
>  import inspect
> -import imp
>  import importlib.util
>  import datetime as dt
> 
> diff --git a/edkrepo/edkrepo_entry_point.py
> b/edkrepo/edkrepo_entry_point.py index dd2b36e..30d65ff 100644
> --- a/edkrepo/edkrepo_entry_point.py
> +++ b/edkrepo/edkrepo_entry_point.py
> @@ -8,7 +8,7 @@
>  #
> 
>  import argparse
> -import imp
> +import importlib
>  import importlib.util
>  import inspect
>  import json
> @@ -37,7 +37,7 @@ for directory in sitepackages:
>          edkrepo_site_dir = edkrepo_package_path
>          break
>  else:
> -    imp.reload(edkrepo)
> +    importlib.reload(edkrepo)
>      edkrepo_package_path =
> os.path.dirname(os.path.dirname(edkrepo.__file__))
>      for directory in sitepackages:
>          if edkrepo_package_path == directory:
> --
> 2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67581): https://edk2.groups.io/g/devel/message/67581
Mute This Topic: https://groups.io/mt/78195940/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-