Skip to content

Commit

Permalink
Migrate deprecated imp package to importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
robaerd committed Nov 1, 2023
1 parent edea1c4 commit 2b60b1b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
from setuptools import setup, find_packages

import imp
import importlib.util
import importlib.machinery

version = imp.load_source('jams.version', 'jams/version.py')

def load_source(modname, filename):
loader = importlib.machinery.SourceFileLoader(modname, filename)
spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
module = importlib.util.module_from_spec(spec)
loader.exec_module(module)
return module


version = load_source('jams.version', 'jams/version.py')

setup(
name='jams',
Expand Down

0 comments on commit 2b60b1b

Please sign in to comment.