Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace broken imports from version file in setup script #179

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this any more: it may have been relevant when there were version files around that didn't include the git revision, but at this point it's safe to assume that if the version file exists in the expected location, then it was generated by this setup script and does include the git revision.

"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<dev_num>\d+)$', full_v)
if match is None:
dev_num = '0'
Expand Down
Loading