Skip to content

Commit 5b9a83c

Browse files
authored
Merge pull request #83 from skitt/cptrace-py3.12
Use importlib instead of imp in setup_cptrace.py
2 parents 68ed63b + 41f5378 commit 5b9a83c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

setup_cptrace.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python
22

3+
import importlib.util
4+
35
SOURCES = ['cptrace/cptrace.c']
46

57
CLASSIFIERS = [
@@ -17,7 +19,6 @@
1719

1820

1921
def main():
20-
from imp import load_source
2122
from os import path
2223
from sys import argv
2324

@@ -29,7 +30,10 @@ def main():
2930

3031
cptrace_ext = Extension('cptrace', sources=SOURCES)
3132

32-
cptrace = load_source("version", path.join("cptrace", "version.py"))
33+
cptrace_spec = importlib.util.spec_from_file_location("version",
34+
path.join("cptrace", "version.py"))
35+
cptrace = importlib.util.module_from_spec(cptrace_spec)
36+
cptrace_spec.loader.exec_module(cptrace)
3337

3438
install_options = {
3539
"name": cptrace.PACKAGE,

0 commit comments

Comments
 (0)