diff options
author | Zuul <zuul@review.opendev.org> | 2022-02-09 15:51:37 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-02-09 15:51:37 +0000 |
commit | 1503e8d88d5afe7fbcaba04c65287bdeea5377a0 (patch) | |
tree | 24b50fd0ca9f608940482c0157282c5aebe24a9f | |
parent | fbc9f44fa6ef694e090ec239123f10b449469253 (diff) | |
parent | 5d0b2b74d4fb62049ddcc2e4000c7771e0749165 (diff) | |
download | horizon-1503e8d88d5afe7fbcaba04c65287bdeea5377a0.tar.gz |
Merge "Replace deprecated imp module"
-rw-r--r-- | openstack_dashboard/management/commands/migrate_settings.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/openstack_dashboard/management/commands/migrate_settings.py b/openstack_dashboard/management/commands/migrate_settings.py index b3ee87e9f..bae688154 100644 --- a/openstack_dashboard/management/commands/migrate_settings.py +++ b/openstack_dashboard/management/commands/migrate_settings.py @@ -11,7 +11,7 @@ # under the License. import difflib -import imp +import importlib import os import shlex import subprocess @@ -30,16 +30,9 @@ def get_module_path(module_name): """Gets the module path without importing anything. Avoids conflicts with package dependencies. - (taken from http://github.com/sitkatech/pypatch) """ - path = sys.path - for name in module_name.split('.'): - file_pointer, path, desc = imp.find_module(name, path) - path = [path, ] - if file_pointer is not None: - file_pointer.close() - - return path[0] + spec = importlib.util.find_spec(module_name) + return spec.origin class DirContext(object): |