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

Allow source only installations #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "GitPython"]
build-backend = "setuptools.build_meta"
16 changes: 13 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
def git_version(version):
"""Return version with local version identifier."""
import git
repo = git.Repo('.git')

try:
repo = git.Repo('.git')
except git.NoSuchPathError:
# Not in a git repo, assume install through PyPI / source distribution
return version

repo.git.status()
# assert versions are increasing
latest_tag = repo.git.describe(
match='v[0-9]*', tags=True, abbrev=0)
try:
latest_tag = repo.git.describe(
match='v[0-9]*', tags=True, abbrev=0)
except git.exc.GitCommandError:
# No tags found
latest_tag = version
assert parse_version(latest_tag) <= parse_version(version), (
latest_tag, version)
sha = repo.head.commit.hexsha[:8]
Expand Down