Skip to content

Commit

Permalink
imp -> importlib in setup.py (#263)
Browse files Browse the repository at this point in the history
* imp -> importlib in setup.py

* fix import_path
  • Loading branch information
kurtbrose committed Aug 23, 2023
1 parent 3431501 commit 1f883f0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import imp
import importlib.util
import os

from setuptools import setup
Expand All @@ -7,9 +7,17 @@
__contact__ = 'mahmoud@hatnote.com'
__url__ = 'https://github.com/mahmoud/glom'


def import_path(module_name, path):
spec = importlib.util.spec_from_file_location(module_name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module


CUR_PATH = os.path.abspath(os.path.dirname(__file__))
_version_mod_path = os.path.join(CUR_PATH, 'glom', '_version.py')
_version_mod = imp.load_source('_version', _version_mod_path)
_version_mod = import_path('_version', _version_mod_path)
__version__ = _version_mod.__version__


Expand Down

0 comments on commit 1f883f0

Please sign in to comment.