Skip to content

Commit

Permalink
Merge pull request #83 from skitt/cptrace-py3.12
Browse files Browse the repository at this point in the history
Use importlib instead of imp in setup_cptrace.py
  • Loading branch information
spoutn1k authored Dec 11, 2023
2 parents 68ed63b + 41f5378 commit 5b9a83c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions setup_cptrace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python

import importlib.util

SOURCES = ['cptrace/cptrace.c']

CLASSIFIERS = [
Expand All @@ -17,7 +19,6 @@


def main():
from imp import load_source
from os import path
from sys import argv

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

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

cptrace = load_source("version", path.join("cptrace", "version.py"))
cptrace_spec = importlib.util.spec_from_file_location("version",
path.join("cptrace", "version.py"))
cptrace = importlib.util.module_from_spec(cptrace_spec)
cptrace_spec.loader.exec_module(cptrace)

install_options = {
"name": cptrace.PACKAGE,
Expand Down

0 comments on commit 5b9a83c

Please sign in to comment.