summaryrefslogtreecommitdiffstats
path: root/docs/conf.py
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2014-06-16 00:46:16 +0200
committerNicolas Hennion <nicolas@nicolargo.com>2014-06-16 18:14:35 +0200
commit4b82e4ad2722cc585e20141959a6ddeb859c4a04 (patch)
treedc141923961fade124dc95f052065f63011a0663 /docs/conf.py
parentfb9095b96909328dccfbaaa2c3b1c8eef769e037 (diff)
Fix Sphinx documentation
Perpetual version string and copyright year. Fix Sphinx warnings.
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 0c304658..e4e1299e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,12 +11,31 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import datetime
+import os
# 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('.'))
+cwd = os.path.realpath(os.path.dirname(__file__))
+project_path = os.path.realpath(os.path.join(cwd, '..', 'glances'))
+
+def get_version():
+ init_file = os.path.realpath(os.path.join(project_path, '__init__.py'))
+ f = open(init_file, 'r')
+ try:
+ for line in f:
+ if line.startswith('__version__'):
+ return line.strip().split(' = ')[1]
+ else:
+ raise ValueError("Version string not found")
+ finally:
+ f.close()
+
+_version = get_version()
+_year = datetime.datetime.now().year
+_copyright = u'{0}, Nicolas Hennion'.format(_year)
# -- General configuration -----------------------------------------------------
@@ -41,16 +60,16 @@ master_doc = 'index'
# General information about the project.
project = u'Glances'
-copyright = u'2014, Nicolas Hennion'
+copyright = _copyright
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '1.7.5'
+version = _version
# The full version, including alpha/beta/rc tags.
-release = '1.7.5'
+release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -120,7 +139,7 @@ html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+#html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.