Skip to content

Commit

Permalink
Rework setup.py to use __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
ross committed Nov 11, 2023
1 parent 6303c15 commit d3fb5ef
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from os import environ
from subprocess import CalledProcessError, check_output
#!/usr/bin/env python

from setuptools import find_packages, setup

Expand All @@ -12,23 +11,12 @@ def descriptions():


def version():
version = 'unknown'
with open('octodns_azure/__init__.py') as fh:
for line in fh:
if line.startswith('__VERSION__'):
version = line.split("'")[1]
if line.startswith('__version__'):
return line.split("'")[2]
break

# pep440 style public & local version numbers
if environ.get('OCTODNS_RELEASE', False):
# public
return version
try:
sha = check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8')[:8]
except (CalledProcessError, FileNotFoundError):
sha = 'unknown'
# local
return f'{version}+{sha}'
raise Exception('failed to determine version number')


description, long_description = descriptions()
Expand Down

0 comments on commit d3fb5ef

Please sign in to comment.