1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-21 19:01:07 +03:00

use version from package init also for sphinx docs, insert toplevel dir into sys.path

This commit is contained in:
Thomas Waldmann
2015-01-31 06:01:52 +01:00
parent 5431c931bb
commit 44c2b38cde

View File

@@ -12,13 +12,28 @@
# 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
def read_file(filename, encoding='utf8'):
"""Read unicode from given file."""
with codecs.open(filename, encoding=encoding) as fd:
return fd.read()
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')
meta = dict(re.findall(r"""__([a-z]+)__ = "([^"]+)""", read_file(init_fn)))
# 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 +73,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.