Uses pkg_resources to figure out radicale's version

This commit is contained in:
Frank Sachsenheim 2018-01-14 18:29:37 +01:00 committed by Unrud
parent 0ea72368b0
commit 062e85366d
2 changed files with 9 additions and 11 deletions

View File

@ -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"),),

View File

@ -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"],