Skip to content

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanantolo committed Jul 26, 2024
1 parent 6ad9b3b commit a2f926f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
from setuptools import setup, find_packages
import subprocess

def get_version_from_git():
try:
version = subprocess.check_output(["git", "describe", "--tags", "--abbrev=0"]).strip().decode('utf-8')
return version
except Exception as e:
print(f"Error getting version from git: {e}")
return "0.0.0" # Default or fallback version

# Dynamically set the long_description from readme_pypi.md, if available
try:
with open('./docs/README_pypi.md', encoding='utf-8') as f:
long_description = f.read()
except FileNotFoundError:
# Fallback to a default description or leave as is if setup.cfg has enough info
long_description = None

if __name__ == "__main__":
setup(
version=get_version_from_git(),
long_description=long_description,
long_description_content_type='text/markdown',
packages=find_packages(where="src"),
Expand Down

0 comments on commit a2f926f

Please sign in to comment.