mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #1101 from octodns/fix-script-release
__VERSION__ -> __version__ in script/release and internal refs
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
15
script/sdist
15
script/sdist
@@ -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"
|
||||
@@ -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'
|
||||
),
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user