Skip to content

Commit

Permalink
Merge pull request #1209 from StackStorm/fix_version_v0.8
Browse files Browse the repository at this point in the history
Fix docs versions, forever.
  • Loading branch information
Dmitri Zimin(e) committed Mar 3, 2015
2 parents 58a8070 + 6622cce commit f9403be
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import sys
import os
import itertools

# 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 @@ -60,11 +61,23 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# the __version__ is 0.8.0 or 0.9dev
# the version is short 0.8 version, to refer docs.
version = '.'.join(__version__.split('.')[:2])
# The full version, including alpha/beta/rc tags.
release = __version__


def previous_version(ver):
# XXX: on incrementing major version, minor version counter is lost!
major, minor = ver.split('.')
minor = int("".join(itertools.takewhile(str.isdigit, minor)))
return ".".join([major, str(minor - 1)])

# The short versions of two previous releases, e.g. 0.8 and 0.7
version_minus_1 = previous_version(version)
version_minus_2 = previous_version(version_minus_1)

# extlink configurator sphinx.ext.extlinks
extlinks = {
'github_st2': ('/~https://github.com/StackStorm/st2/blob/master/%s', None),
Expand Down Expand Up @@ -228,11 +241,9 @@
'source_suffix': source_suffix,
'versions': [
('latest', 'http://docs.stackstorm.com/latest'),
(version, 'http://docs.stackstorm.com/'),
# TODO(dzimine): get "prev stable version" from somewhere (?)
('0.8', 'http://docs.stackstorm.com/'),
('0.7', 'http://docs.stackstorm.com/0.7'),
('0.6', 'http://docs.stackstorm.com/0.6.0')
(version, 'http://docs.stackstorm.com/latest'),
(version_minus_1, 'http://docs.stackstorm.com/%s' % version_minus_1),
(version_minus_2, 'http://docs.stackstorm.com/%s' % version_minus_2),
],
'current_version': version
}
Expand Down

0 comments on commit f9403be

Please sign in to comment.