From 35c272dda20e29423e25c5f8cf811216dcff9bb3 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Thu, 11 Jun 2015 19:28:49 +0200 Subject: [PATCH] Switch to setuptools-scm --- .gitignore | 1 + docs/conf.py | 14 ++------------ setup.py | 14 ++------------ vdirsyncer/__init__.py | 4 +++- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 0688af8..f83ff17 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build env *.egg-info .cache +.eggs .xprocess dist tests/storage/dav/servers/* diff --git a/docs/conf.py b/docs/conf.py index 22cf9a4..367cae4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,9 +2,6 @@ import datetime import os -import sys - -import pkg_resources from sphinx.ext import autodoc @@ -19,15 +16,8 @@ project = u'vdirsyncer' copyright = (u'2014-{}, Markus Unterwaditzer & contributors' .format(datetime.date.today().strftime('%Y'))) -try: - # The full version, including alpha/beta/rc tags. - release = pkg_resources.require('vdirsyncer')[0].version -except pkg_resources.DistributionNotFound: - print('To build the documentation, the distribution information of ' - 'vdirsyncer has to be available. Run "setup.py develop" to do ' - 'this.') - sys.exit(1) - +import vdirsyncer +release = vdirsyncer.__version__ version = '.'.join(release.split('.')[:2]) # The short X.Y version. exclude_patterns = ['_build'] diff --git a/setup.py b/setup.py index 10a3ad9..1236d9a 100644 --- a/setup.py +++ b/setup.py @@ -3,23 +3,13 @@ Vdirsyncer is a synchronization tool for vdir. See the README for more details. ''' -import ast -import re - from setuptools import find_packages, setup -_version_re = re.compile(r'__version__\s+=\s+(.*)') - - -with open('vdirsyncer/__init__.py', 'rb') as f: - version = str(ast.literal_eval(_version_re.search( - f.read().decode('utf-8')).group(1))) - - setup( name='vdirsyncer', - version=version, + use_scm_version=True, + setup_requires=['setuptools_scm'], author='Markus Unterwaditzer', author_email='markus@unterwaditzer.net', url='https://github.com/untitaker/vdirsyncer', diff --git a/vdirsyncer/__init__.py b/vdirsyncer/__init__.py index 5cfb135..bd1b9be 100644 --- a/vdirsyncer/__init__.py +++ b/vdirsyncer/__init__.py @@ -2,7 +2,9 @@ ''' vdirsyncer is a synchronization tool for vdir. See the README for more details. ''' -__version__ = '0.5.1' + +import pkg_resources +__version__ = pkg_resources.get_distribution('vdirsyncer').version PROJECT_HOME = 'https://github.com/untitaker/vdirsyncer' DOCS_HOME = 'https://vdirsyncer.readthedocs.org/en/latest'