From 549508b644dcb73299a2dc9b3fc6776208e4d0d8 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Sat, 11 Nov 2023 12:41:14 -0800 Subject: [PATCH 1/2] Add __version__ and deprecate __VERSION__ to line up with pep8 recommendation --- octodns_ns1/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/octodns_ns1/__init__.py b/octodns_ns1/__init__.py index 1c881c3..04db053 100644 --- a/octodns_ns1/__init__.py +++ b/octodns_ns1/__init__.py @@ -18,7 +18,8 @@ from octodns.record.geo import GeoCodes from octodns.record.geo_data import geo_data -__VERSION__ = '0.0.6' +# TODO: remove __VERSION__ with the next major version release +__version__ = __VERSION__ = '0.0.6' def _ensure_endswith_dot(string): From e00bcbd41bad1fc4ad1f8ee96cda32117a743282 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Sat, 11 Nov 2023 13:19:25 -0800 Subject: [PATCH 2/2] Simplify versioning, just use __version__ in setup.py --- setup.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 02e945c..d4b7118 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ -from os import environ -from subprocess import CalledProcessError, check_output +#!/usr/bin/env python from setuptools import find_packages, setup @@ -12,23 +11,11 @@ def descriptions(): def version(): - version = 'unknown' with open('octodns_ns1/__init__.py') as fh: for line in fh: - if line.startswith('__VERSION__'): - version = line.split("'")[1] - 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}' + if line.startswith('__version__'): + return line.split("'")[1] + return 'unknown' description, long_description = descriptions()