summaryrefslogtreecommitdiff
path: root/openstack_dashboard/management
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-09 15:51:37 +0000
committerGerrit Code Review <review@openstack.org>2022-02-09 15:51:37 +0000
commit1503e8d88d5afe7fbcaba04c65287bdeea5377a0 (patch)
tree24b50fd0ca9f608940482c0157282c5aebe24a9f /openstack_dashboard/management
parentfbc9f44fa6ef694e090ec239123f10b449469253 (diff)
parent5d0b2b74d4fb62049ddcc2e4000c7771e0749165 (diff)
downloadhorizon-1503e8d88d5afe7fbcaba04c65287bdeea5377a0.tar.gz
Merge "Replace deprecated imp module"
Diffstat (limited to 'openstack_dashboard/management')
-rw-r--r--openstack_dashboard/management/commands/migrate_settings.py13
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):