diff --git a/NEWS b/NEWS index 319c4393..239d5331 100644 --- a/NEWS +++ b/NEWS @@ -6,10 +6,11 @@ NEWS ------ -0.5 - **Not released yet** +0.3 - **Not released yet** ========================== * Evolution support +* Version management 0.2 - Snowflakes diff --git a/radicale.py b/radicale.py index e6a8df0c..a0018df3 100755 --- a/radicale.py +++ b/radicale.py @@ -43,6 +43,10 @@ import radicale # Get command-line options parser = optparse.OptionParser() +parser.add_option( + "-v", "--version", action="store_true", + default=False, + help="show version and exit") parser.add_option( "-d", "--daemon", action="store_true", default=radicale.config.getboolean("server", "daemon"), @@ -76,6 +80,11 @@ for option in parser.option_list: value = getattr(options, key) radicale.config.set("server", key, value) +# Print version and exit if the option is given +if options.version: + print(radicale.VERSION) + sys.exit() + # Fork if Radicale is launched as daemon if options.daemon: if os.fork(): diff --git a/radicale/__init__.py b/radicale/__init__.py index 940112f2..62fb1d01 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -49,6 +49,8 @@ except ImportError: from radicale import acl, config, ical, xmlutils +VERSION = "0.3-git" + def _check(request, function): """Check if user has sufficient rights for performing ``request``.""" authorization = request.headers.get("Authorization", None) diff --git a/setup.py b/setup.py index 17a008da..30f90a88 100755 --- a/setup.py +++ b/setup.py @@ -38,17 +38,22 @@ For further information, please visit the `Radicale Website from distutils.core import setup -# When the version is updated, ``version`` and ``download_url`` must be modified -# A new section in the ``NEWS`` file must be added too +import radicale + + +# When the version is updated, ``radicale.VERSION`` must be modified and +# ``download_url`` must be uncommented. A new section in the ``NEWS`` file +# must be added too. setup( name="Radicale", - version="0.5-git", + version=radicale.VERSION, description="CalDAV Server", long_description=__doc__, author="Guillaume Ayoub", author_email="guillaume.ayoub@kozea.fr", url="http://www.radicale.org/", - #download_url="http://radicale.org/src/radicale/Radicale-0.5.tar.gz", + #download_url="http://www.radicale.org/src/radicale/Radicale-%s.tar.gz" % \ + # radicale.VERSION, license="GNU GPL v3", platforms="Any", packages=["radicale", "radicale.acl"],