From 0021f35b2ab6f0f322dd47b3a9f025afef472d74 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Wed, 10 Apr 2019 11:46:10 +0200 Subject: [PATCH] Use setuptools_scm for versioning --- docs/conf.py | 85 ++++++++++++++++++++++++++++------------------------ setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 48 insertions(+), 41 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index f4177da..9750b9e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,39 +1,46 @@ -import os -import sys - -# This is needed since django_select2 requires django model modules -# and those modules assume that django settings is configured and -# have proper DB settings. -# Using this we give a proper environment with working django settings. -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings") - -# 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 -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('../tests.testapp')) -sys.path.insert(0, os.path.abspath('..')) - -extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.napoleon', - 'sphinx.ext.inheritance_diagram', - 'sphinx.ext.intersphinx', - 'sphinx.ext.viewcode', - 'sphinx.ext.doctest', -] - -intersphinx_mapping = { - 'python': ('http://docs.python.org/3', None), - 'django': ('https://docs.djangoproject.com/en/stable/', - 'https://docs.djangoproject.com/en/stable/_objects/'), -} - -autodoc_default_flags = ['members', 'show-inheritance'] -autodoc_member_order = 'bysource' - -inheritance_graph_attrs = dict(rankdir='TB') - -inheritance_node_attrs = dict(shape='rect', fontsize=14, fillcolor='gray90', - color='gray30', style='filled') - -inheritance_edge_attrs = dict(penwidth=0.75) +import os +import sys + +from pkg_resources import get_distribution + +# This is needed since django_select2 requires django model modules +# and those modules assume that django settings is configured and +# have proper DB settings. +# Using this we give a proper environment with working django settings. +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings") + +# 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 +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath('../tests.testapp')) +sys.path.insert(0, os.path.abspath('..')) + + +release = get_distribution('django_select2').version +version = '.'.join(release.split('.')[:2]) + + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', + 'sphinx.ext.inheritance_diagram', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', + 'sphinx.ext.doctest', +] + +intersphinx_mapping = { + 'python': ('http://docs.python.org/3', None), + 'django': ('https://docs.djangoproject.com/en/stable/', + 'https://docs.djangoproject.com/en/stable/_objects/'), +} + +autodoc_default_flags = ['members', 'show-inheritance'] +autodoc_member_order = 'bysource' + +inheritance_graph_attrs = dict(rankdir='TB') + +inheritance_node_attrs = dict(shape='rect', fontsize=14, fillcolor='gray90', + color='gray30', style='filled') + +inheritance_edge_attrs = dict(penwidth=0.75) diff --git a/setup.cfg b/setup.cfg index f71b20f..0708b89 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,7 @@ install_requires = django>=2.0 django-appconf>=0.6.0 setup_requires = - very-good-setuptools-git-version + setuptools_scm sphinx pytest-runner tests_require = diff --git a/setup.py b/setup.py index 80a6cb5..92354ee 100755 --- a/setup.py +++ b/setup.py @@ -2,4 +2,4 @@ from setuptools import setup -setup(version_format='{tag}') +setup(use_scm_version=True)