diff --git a/setup.py b/setup.py index 91ad65b..6f23bc7 100644 --- setup.py.orig +++ setup.py @@ -10,10 +10,11 @@ import os import re -from setuptools import Extension, find_packages, setup +import runpy from subprocess import check_output from numpy import get_include +from setuptools import Extension, find_packages, setup MAJOR = 5 @@ -82,13 +83,9 @@ def write_version_py(filename=DEFAULT_VERSION_FILE, git_rev, dev_num = git_version() elif os.path.exists(DEFAULT_VERSION_FILE): # must be a source distribution, use existing version file - try: - from scimath._version import git_revision as git_rev - from scimath._version import full_version as full_v - except ImportError: - raise ImportError("Unable to import git_revision. Try removing " - "scimath/_version.py and the build directory " - "before building.") + context = runpy.run_path(DEFAULT_VERSION_FILE) + git_rev = context["git_revision"] + full_v = context["full_version"] match = re.match(r'.*?\.dev(?P\d+)$', full_v) if match is None: dev_num = '0'