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.
This commit is contained in:
Thomas Waldmann
2015-01-29 01:20:45 +01:00
parent c5db07cf0a
commit 9c98e1e7e5
3 changed files with 13 additions and 2 deletions
+9
View File
@@ -1 +1,10 @@
"""Let's Encrypt.""" """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"""
+2 -1
View File
@@ -8,6 +8,7 @@ import sys
import zope.component import zope.component
import zope.interface import zope.interface
from letsencrypt import VERSION
from letsencrypt.client import CONFIG from letsencrypt.client import CONFIG
from letsencrypt.client import client from letsencrypt.client import client
from letsencrypt.client import display from letsencrypt.client import display
@@ -19,7 +20,7 @@ from letsencrypt.client import log
def main(): # pylint: disable=too-many-statements,too-many-branches def main(): # pylint: disable=too-many-statements,too-many-branches
"""Command line argument parsing and main script execution.""" """Command line argument parsing and main script execution."""
parser = argparse.ArgumentParser( 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", parser.add_argument("-d", "--domains", dest="domains", metavar="DOMAIN",
nargs="+") nargs="+")
+2 -1
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from setuptools import setup from setuptools import setup
from letsencrypt import VERSION
install_requires = [ install_requires = [
'argparse', 'argparse',
@@ -31,7 +32,7 @@ testing_extras = [
setup( setup(
name="letsencrypt", name="letsencrypt",
version="0.1", version=VERSION,
description="Let's Encrypt", description="Let's Encrypt",
author="Let's Encrypt Project", author="Let's Encrypt Project",
license="", license="",