Skip to content

Commit 7b68883

Browse files
authored
Merge pull request #6680 from ales-erjavec/fixes/setup-imp
[FIX] setup.py: Replace use of imp module
2 parents 97d0858 + 2b1558a commit 7b68883

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,12 @@ def write_version_py(filename='Orange/version.py'):
163163
GIT_REVISION = git_version()
164164
elif os.path.exists('Orange/version.py'):
165165
# must be a source distribution, use existing version file
166-
import imp
167-
version = imp.load_source("Orange.version", "Orange/version.py")
166+
import importlib.util
167+
spec = importlib.util.spec_from_file_location(
168+
"Orange.version", filename
169+
)
170+
version = importlib.util.module_from_spec(spec)
171+
spec.loader.exec_module(version)
168172
GIT_REVISION = version.git_revision
169173
else:
170174
GIT_REVISION = "Unknown"

0 commit comments

Comments
 (0)