diff --git a/radicale/__init__.py b/radicale/__init__.py index 88b1bb6..ca25417 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -33,6 +33,7 @@ import io import itertools import logging import os +import pkg_resources import posixpath import pprint import random @@ -52,7 +53,8 @@ import vobject from . import auth, rights, storage, web, xmlutils -VERSION = "2.1.8" + +VERSION = pkg_resources.get_distribution('radicale').version NOT_ALLOWED = ( client.FORBIDDEN, (("Content-Type", "text/plain"),), diff --git a/setup.py b/setup.py index 2114d62..605a8f0 100755 --- a/setup.py +++ b/setup.py @@ -35,35 +35,31 @@ For further information, please visit the `Radicale Website """ -import re import sys -from os import path from setuptools import setup +# When the version is updated, a new section in the NEWS.md file must be +# added too. +VERSION = "2.1.8" WEB_FILES = ["web/css/icon.png", "web/css/main.css", "web/fn.js", "web/index.html"] -init_path = path.join(path.dirname(__file__), "radicale", "__init__.py") -with open(init_path, "r", encoding="utf-8") as fd: - version = re.search('VERSION = "([^"]+)"', fd.read().strip()).group(1) - needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) pytest_runner = ['pytest-runner'] if needs_pytest else [] -# When the version is updated, ``radicale.VERSION`` must be modified. -# A new section in the ``NEWS`` file must be added too. + setup( name="Radicale", - version=version, + version=VERSION, description="CalDAV and CardDAV Server", long_description=__doc__, author="Guillaume Ayoub", author_email="guillaume.ayoub@kozea.fr", url="http://www.radicale.org/", download_url=("http://pypi.python.org/packages/source/R/Radicale/" - "Radicale-%s.tar.gz" % version), + "Radicale-%s.tar.gz" % VERSION), license="GNU GPL v3", platforms="Any", packages=["radicale"],