Skip to content

Commit

Permalink
doc: Fixing the version info.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithro committed Mar 27, 2017
1 parent 4243406 commit 0564fae
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

import re

import sphinx_rtd_theme

# -- General configuration -----------------------------------------------------
Expand Down Expand Up @@ -53,10 +55,14 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
import pkg_resources
migen_version = pkg_resources.require("migen")[0].version

# The short X.Y version.
version = '1.0'
version = re.sub(r'(\d+\.\d+)(\..*)', r'\1', migen_version)
# The full version, including alpha/beta/rc tags.
release = '1.0'
release = migen_version
print("%s %s" % (version, release))

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -227,6 +233,7 @@

# -- Options for links to the code ---------------------------------------------
# Taken from numpy - https://github.com/numpy/numpy/blob/master/doc/source/conf.py#L273
import migen
import inspect
from os.path import relpath, dirname

Expand Down Expand Up @@ -279,11 +286,11 @@ def linkcode_resolve(domain, info):
else:
linespec = ""

fn = relpath(fn, start=dirname(numpy.__file__))
fn = relpath(fn, start=dirname(migen.__file__))

if 'dev' in numpy.__version__:
if 'dev' in migen_version:
return "http://github.com/m-labs/migen/blob/master/migen/%s%s" % (
fn, linespec)
else:
return "http://github.com/m-labs/migen/blob/v%s/migen/%s%s" % (
numpy.__version__, fn, linespec)
migen.__version__, fn, linespec)

0 comments on commit 0564fae

Please sign in to comment.