mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Switch to setuptools-scm.
This commit is contained in:
parent
bd61710591
commit
42641f5eb4
8 changed files with 25 additions and 33 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -10,3 +10,4 @@ htmlcov/
|
||||||
*.pyc
|
*.pyc
|
||||||
dist/
|
dist/
|
||||||
tests/docs/_build/
|
tests/docs/_build/
|
||||||
|
.eggs/
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# flake8: noqa
|
from .base import Configuration # noqa
|
||||||
from .base import Configuration
|
from .decorators import pristinemethod # noqa
|
||||||
from .decorators import pristinemethod
|
from .version import __version__ # noqa
|
||||||
|
|
||||||
|
|
||||||
__version__ = '2.1'
|
|
||||||
__all__ = ['Configuration', 'pristinemethod']
|
__all__ = ['Configuration', 'pristinemethod']
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,8 @@ class ConfigurationImporter(object):
|
||||||
and os.environ.get('RUN_MAIN') == 'true'):
|
and os.environ.get('RUN_MAIN') == 'true'):
|
||||||
|
|
||||||
message = ("django-configurations version {0}, using "
|
message = ("django-configurations version {0}, using "
|
||||||
"configuration '{1}'".format(__version__,
|
"configuration {1}".format(__version__ or "",
|
||||||
self.name))
|
self.name))
|
||||||
self.logger.debug(stylize(message))
|
self.logger.debug(stylize(message))
|
||||||
|
|
||||||
def find_module(self, fullname, path=None):
|
def find_module(self, fullname, path=None):
|
||||||
|
|
|
||||||
7
configurations/version.py
Normal file
7
configurations/version.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
from pkg_resources import get_distribution, DistributionNotFound
|
||||||
|
|
||||||
|
try:
|
||||||
|
__version__ = get_distribution(__name__).version
|
||||||
|
except DistributionNotFound:
|
||||||
|
# package is not installed
|
||||||
|
__version__ = None
|
||||||
|
|
@ -18,7 +18,8 @@ v2.2 (2019-12-03)
|
||||||
|
|
||||||
- Replace ``django.utils.six`` with ``six`` to support Django >= 3.
|
- Replace ``django.utils.six`` with ``six`` to support Django >= 3.
|
||||||
|
|
||||||
- Start using tox-travis for simplified test harness management.
|
- Start using tox-travis and setuptools-scm for simplified test harness
|
||||||
|
and release management.
|
||||||
|
|
||||||
v2.1 (2018-08-16)
|
v2.1 (2018-08-16)
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
14
docs/conf.py
14
docs/conf.py
|
|
@ -14,6 +14,8 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from pkg_resources import get_distribution
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
|
@ -48,14 +50,10 @@ copyright = u'2012-2014, Jannis Leidel and other contributors'
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
try:
|
# The full version, including alpha/beta/rc tags.
|
||||||
from configurations import __version__
|
release = get_distribution("django-configurations").version
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '.'.join(__version__.split('.')[:2])
|
version = ".".join(release.split(".")[:2])
|
||||||
# The full version, including alpha/beta/rc tags.
|
|
||||||
release = __version__
|
|
||||||
except ImportError:
|
|
||||||
version = release = 'dev'
|
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ parallel = 1
|
||||||
include = configurations/*,tests/*
|
include = configurations/*,tests/*
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = .tox,docs/*
|
exclude = .tox,docs/*,.eggs
|
||||||
ignore = E501,E127,E128,E124,W503
|
ignore = E501,E127,E128,E124,W503
|
||||||
|
|
|
||||||
19
setup.py
19
setup.py
|
|
@ -1,34 +1,19 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import ast
|
|
||||||
import os
|
import os
|
||||||
import codecs
|
import codecs
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
class VersionFinder(ast.NodeVisitor):
|
|
||||||
def __init__(self):
|
|
||||||
self.version = None
|
|
||||||
|
|
||||||
def visit_Assign(self, node):
|
|
||||||
if node.targets[0].id == '__version__':
|
|
||||||
self.version = node.value.s
|
|
||||||
|
|
||||||
|
|
||||||
def read(*parts):
|
def read(*parts):
|
||||||
filename = os.path.join(os.path.dirname(__file__), *parts)
|
filename = os.path.join(os.path.dirname(__file__), *parts)
|
||||||
with codecs.open(filename, encoding='utf-8') as fp:
|
with codecs.open(filename, encoding='utf-8') as fp:
|
||||||
return fp.read()
|
return fp.read()
|
||||||
|
|
||||||
|
|
||||||
def find_version(*parts):
|
|
||||||
finder = VersionFinder()
|
|
||||||
finder.visit(ast.parse(read(*parts)))
|
|
||||||
return finder.version
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="django-configurations",
|
name="django-configurations",
|
||||||
version=find_version("configurations", "__init__.py"),
|
use_scm_version={"version_scheme": "post-release", "local_scheme": "dirty-tag"},
|
||||||
|
setup_requires=["setuptools_scm"],
|
||||||
url='https://django-configurations.readthedocs.io/',
|
url='https://django-configurations.readthedocs.io/',
|
||||||
license='BSD',
|
license='BSD',
|
||||||
description="A helper for organizing Django settings.",
|
description="A helper for organizing Django settings.",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue