mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 00:02:14 -04:00
parse version number from package init, avoid package import
This commit is contained in:
parent
9c98e1e7e5
commit
219b25cd98
3 changed files with 15 additions and 12 deletions
|
|
@ -1,10 +1,3 @@
|
|||
"""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"""
|
||||
__version__ = "0.1"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import sys
|
|||
import zope.component
|
||||
import zope.interface
|
||||
|
||||
from letsencrypt import VERSION
|
||||
import letsencrypt
|
||||
from letsencrypt.client import CONFIG
|
||||
from letsencrypt.client import client
|
||||
from letsencrypt.client import display
|
||||
|
|
@ -20,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="letsencrypt client %s" % VERSION)
|
||||
description="letsencrypt client %s" % letsencrypt.__version__)
|
||||
|
||||
parser.add_argument("-d", "--domains", dest="domains", metavar="DOMAIN",
|
||||
nargs="+")
|
||||
|
|
|
|||
14
setup.py
14
setup.py
|
|
@ -1,7 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import re
|
||||
import codecs
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
from letsencrypt import VERSION
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
# read version number (and other metadata) from package init
|
||||
init_fn = os.path.join(here, 'letsencrypt', '__init__.py')
|
||||
with codecs.open(init_fn, encoding='utf8') as meta_file:
|
||||
content = meta_file.read()
|
||||
meta = dict(re.findall(r"""__([a-z]+)__ = "([^"]+)""", content))
|
||||
|
||||
install_requires = [
|
||||
'argparse',
|
||||
|
|
@ -32,7 +42,7 @@ testing_extras = [
|
|||
|
||||
setup(
|
||||
name="letsencrypt",
|
||||
version=VERSION,
|
||||
version=meta['version'],
|
||||
description="Let's Encrypt",
|
||||
author="Let's Encrypt Project",
|
||||
license="",
|
||||
|
|
|
|||
Loading…
Reference in a new issue