diff --git a/octodns/cmds/args.py b/octodns/cmds/args.py index 52b42da..1aefbea 100644 --- a/octodns/cmds/args.py +++ b/octodns/cmds/args.py @@ -10,7 +10,7 @@ from sys import stderr, stdout from yaml import safe_load -from octodns import __VERSION__ +from octodns import __version__ class ArgumentParser(_Base): @@ -24,7 +24,7 @@ class ArgumentParser(_Base): super().__init__(*args, **kwargs) def parse_args(self, default_log_level=INFO): - version = f'octoDNS {__VERSION__}' + version = f'octoDNS {__version__}' self.add_argument( '--version', action='version', diff --git a/octodns/manager.py b/octodns/manager.py index 1753269..3ec163c 100644 --- a/octodns/manager.py +++ b/octodns/manager.py @@ -11,7 +11,7 @@ from logging import getLogger from os import environ from sys import stdout -from . import __VERSION__ +from . import __version__ from .idna import IdnaDict, idna_decode, idna_encode from .processor.arpa import AutoArpa from .processor.meta import MetaProcessor @@ -89,7 +89,7 @@ class Manager(object): def __init__( self, config_file, max_workers=None, include_meta=False, auto_arpa=False ): - version = self._try_version('octodns', version=__VERSION__) + version = self._try_version('octodns', version=__version__) self.log.info( '__init__: config_file=%s, (octoDNS %s)', config_file, version ) @@ -308,7 +308,10 @@ class Manager(object): # finally try and import the module and see if it has a __VERSION__ if module is None: module = import_module(module_name) - return getattr(module, '__VERSION__', None) + # TODO: remove the __VERSION__ fallback eventually? + return getattr( + module, '__version__', getattr(module, '__VERSION__', None) + ) def _import_module(self, module_name): current = module_name diff --git a/octodns/processor/meta.py b/octodns/processor/meta.py index c9e4a05..ee56ef8 100644 --- a/octodns/processor/meta.py +++ b/octodns/processor/meta.py @@ -6,7 +6,7 @@ from datetime import datetime from logging import getLogger from uuid import uuid4 -from .. import __VERSION__ +from .. import __version__ from ..record import Record from .base import BaseProcessor @@ -91,7 +91,7 @@ class MetaProcessor(BaseProcessor): uuid = self.uuid() if include_uuid else None values.append(f'uuid={uuid}') if include_version: - values.append(f'octodns-version={__VERSION__}') + values.append(f'octodns-version={__version__}') self.include_provider = include_provider values.sort() self.values = values diff --git a/script/changelog b/script/changelog index 4257b67..c270fb9 100755 --- a/script/changelog +++ b/script/changelog @@ -2,6 +2,6 @@ set -e -VERSION=v$(grep __VERSION__ octodns/__init__.py | sed -e "s/^[^']*'//" -e "s/'$//") +VERSION=v$(grep __version__ octodns/__init__.py | sed -e "s/^[^']*'//" -e "s/'$//") echo $VERSION git log --pretty="%h - %cr - %s (%an)" "${VERSION}..HEAD" diff --git a/script/release b/script/release index ac89a3d..da5d216 100755 --- a/script/release +++ b/script/release @@ -32,7 +32,7 @@ fi # Set so that setup.py will create a public release style version number export OCTODNS_RELEASE=1 -VERSION="$(grep "^__VERSION__" "$ROOT/octodns/__init__.py" | sed -e "s/.* = '//" -e "s/'$//")" +VERSION="$(grep "^__version__" "$ROOT/octodns/__init__.py" | sed -e "s/.* = '//" -e "s/'$//")" git tag -s "v$VERSION" -m "Release $VERSION" git push origin "v$VERSION" diff --git a/script/sdist b/script/sdist deleted file mode 100755 index 1ab0949..0000000 --- a/script/sdist +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -if ! git diff-index --quiet HEAD --; then - echo "Changes in local directory, commit or clear" >&2 - exit 1 -fi - -SHA=$(git rev-parse HEAD) -python setup.py sdist -TARBALL="dist/octodns-$SHA.tar.gz" -mv dist/octodns-0.*.tar.gz "$TARBALL" - -echo "Created $TARBALL" diff --git a/tests/test_octodns_manager.py b/tests/test_octodns_manager.py index ae2f415..2bec87e 100644 --- a/tests/test_octodns_manager.py +++ b/tests/test_octodns_manager.py @@ -16,7 +16,7 @@ from helpers import ( TemporaryDirectory, ) -from octodns import __VERSION__ +from octodns import __version__ from octodns.idna import IdnaDict, idna_encode from octodns.manager import ( MainThreadExecutor, @@ -746,13 +746,13 @@ class TestManager(TestCase): manager = Manager(get_config_filename('simple.yaml')) class DummyModule(object): - __VERSION__ = '2.3.4' + __version__ = '2.3.4' dummy_module = DummyModule() # use importlib.metadata.version self.assertTrue( - __VERSION__, + __version__, manager._try_version( 'octodns', module=dummy_module, version='1.2.3' ), diff --git a/tests/test_octodns_processor_meta.py b/tests/test_octodns_processor_meta.py index 65ed743..c5af501 100644 --- a/tests/test_octodns_processor_meta.py +++ b/tests/test_octodns_processor_meta.py @@ -5,7 +5,7 @@ from unittest import TestCase from unittest.mock import patch -from octodns import __VERSION__ +from octodns import __version__ from octodns.processor.meta import MetaProcessor from octodns.provider.plan import Plan from octodns.record import Create, Record, Update @@ -67,7 +67,7 @@ class TestMetaProcessor(TestCase): uuid_mock.side_effect = [Exception('not used')] now_mock.side_effect = [Exception('not used')] proc = MetaProcessor('test', include_time=False, include_version=True) - self.assertEqual([f'octodns-version={__VERSION__}'], proc.values) + self.assertEqual([f'octodns-version={__version__}'], proc.values) # just provider proc = MetaProcessor('test', include_time=False, include_provider=True) @@ -86,7 +86,7 @@ class TestMetaProcessor(TestCase): ) self.assertEqual( [ - f'octodns-version={__VERSION__}', + f'octodns-version={__version__}', 'time=the-time', 'uuid=abcdef-1234567890', ],