diff --git a/docs/conf.py b/docs/conf.py index fbcd61065..018d2afed 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,13 +12,22 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys +import codecs import os +import re +import sys + +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 fd: + meta = dict(re.findall(r"""__([a-z]+)__ = "([^"]+)""", fd.read())) # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath(os.path.join(here, '..'))) # -- General configuration ------------------------------------------------ @@ -58,9 +67,9 @@ copyright = u'2014, Let\'s Encrypt Project' # built documents. # # The short X.Y version. -version = '0.1' +version = '.'.join(meta['version'].split('.')[:2]) # The full version, including alpha/beta/rc tags. -release = '0.1' +release = meta['version'] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/letsencrypt/__init__.py b/letsencrypt/__init__.py index 9fe93c4db..b36747b5f 100644 --- a/letsencrypt/__init__.py +++ b/letsencrypt/__init__.py @@ -1,2 +1,3 @@ """Let's Encrypt.""" +# version number like 1.2.3a0, must have at least 2 parts, like 1.2 __version__ = "0.1"