From 9c98e1e7e5608b2f6f0fcdf345d926fc306cba94 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 29 Jan 2015 01:20:45 +0100 Subject: [PATCH] have letsencrypt.VERSION, show it in letsencrypt --help, use it in setup.py note: we had some discussion about potential problems importing VERSION from main package. SO link: http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package See also my comment in __init__.py - maybe we can add that "version detection from git tags" magic later. --- letsencrypt/__init__.py | 9 +++++++++ letsencrypt/scripts/main.py | 3 ++- setup.py | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/letsencrypt/__init__.py b/letsencrypt/__init__.py index 9c0ff7662..0f56daa29 100644 --- a/letsencrypt/__init__.py +++ b/letsencrypt/__init__.py @@ -1 +1,10 @@ """Let's Encrypt.""" + +# do not import stuff here. this file is used by setup.py, thus importing +# stuff here might break setup.py as dependencies are not installed yet. + +VERSION_TUPLE = 0, 1, 0, "a0" +"""version tuple: major, minor, micro, {a|b|rc}N - see PEP440""" + +VERSION = "%d.%d.%d%s" % VERSION_TUPLE +"""version as str""" diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py index 4dfa70764..c30b455c3 100755 --- a/letsencrypt/scripts/main.py +++ b/letsencrypt/scripts/main.py @@ -8,6 +8,7 @@ import sys import zope.component import zope.interface +from letsencrypt import VERSION from letsencrypt.client import CONFIG from letsencrypt.client import client from letsencrypt.client import display @@ -19,7 +20,7 @@ from letsencrypt.client import log def main(): # pylint: disable=too-many-statements,too-many-branches """Command line argument parsing and main script execution.""" parser = argparse.ArgumentParser( - description="An ACME client that can update Apache configurations.") + description="letsencrypt client %s" % VERSION) parser.add_argument("-d", "--domains", dest="domains", metavar="DOMAIN", nargs="+") diff --git a/setup.py b/setup.py index 004388b5e..5737e83c3 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from setuptools import setup +from letsencrypt import VERSION install_requires = [ 'argparse', @@ -31,7 +32,7 @@ testing_extras = [ setup( name="letsencrypt", - version="0.1", + version=VERSION, description="Let's Encrypt", author="Let's Encrypt Project", license="",