From 5d466ac318c527bbec9e6c18b38e7b91b2c3bcbf Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 28 Jan 2018 14:17:11 +0100 Subject: [PATCH] Use setuptools_scm. --- authority/__init__.py | 8 ++++++++ docs/conf.py | 8 ++++---- setup.py | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/authority/__init__.py b/authority/__init__.py index 87b45d3..988225b 100644 --- a/authority/__init__.py +++ b/authority/__init__.py @@ -1,3 +1,11 @@ +from pkg_resources import get_distribution, DistributionNotFound + +try: + __version__ = get_distribution('authority').version +except DistributionNotFound: + # package is not installed + pass + LOADING = False diff --git a/docs/conf.py b/docs/conf.py index 1897bc5..c6bf705 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,7 @@ import os import sys +from pkg_resources import get_distribution # 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 @@ -46,11 +47,10 @@ copyright = u'2009, the django-authority team' # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = '0.9' - # The full version, including alpha/beta/rc tags. -release = '0.9dev' +release = get_distribution('authority').version +# The short X.Y version. +version = '.'.join(release.split('.')[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 8cc042c..a8ba73f 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def read(fname): setup( name='django-authority', - version='0.12', + use_scm_version=True, description=( "A Django app that provides generic per-object-permissions " "for Django's auth app." @@ -35,6 +35,7 @@ setup( 'Framework :: Django', ], install_requires=['django'], + setup_requires=['setuptools_scm'], package_data={ 'authority': [ 'fixtures/*.json',