Skip to content

Commit

Permalink
Keep version in docs synced with project one
Browse files Browse the repository at this point in the history
  • Loading branch information
kxepal committed Jul 10, 2014
1 parent 0d414d4 commit 9ba4cd2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@

import sys
import os
import codecs
import re

_docs_path = os.path.dirname(__file__)
_version_path = os.path.abspath(os.path.join(_docs_path,
'..', 'aiohttp', '__init__.py'))
with codecs.open(_version_path, 'r', 'latin1') as fp:
try:
_version_info = re.search(r"^__version__ = '"
r"(?P<major>\d+)"
r"\.(?P<minor>\d+)"
r"\.(?P<patch>\d+)"
r"(?P<tag>.*)?'$",
fp.read(), re.M).groupdict()
except IndexError:
raise RuntimeError('Unable to determine version.')


# 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
Expand Down Expand Up @@ -58,9 +75,9 @@
# built documents.
#
# The short X.Y version.
version = '0.7'
version = '{major}.{minor}'.format(**_version_info)
# The full version, including alpha/beta/rc tags.
release = '0.7.3'
release = '{major}.{minor}.{patch}-{tag}'.format(**_version_info)

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down

0 comments on commit 9ba4cd2

Please sign in to comment.