From 4b82e4ad2722cc585e20141959a6ddeb859c4a04 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Mon, 16 Jun 2014 00:46:16 +0200 Subject: [PATCH] Fix Sphinx documentation Perpetual version string and copyright year. Fix Sphinx warnings. --- MANIFEST.in | 1 - docs/conf.py | 29 ++++++++++++++++++++++++----- docs/index.rst | 8 ++++---- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index efc3d262..dae6a3d7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,4 +10,3 @@ include man/glances.1 recursive-include docs images/*.png glances-doc.html recursive-include glances *.py recursive-include i18n *.mo -prune docs/_build 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. diff --git a/docs/index.rst b/docs/index.rst index 81d714ee..aad08bfc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,11 +1,11 @@ -Welcome to Glances's documentation! -=================================== +Welcome to Glances documentation! +================================= **Glances** is a cross-platform curses-based monitoring tool written in Python. It uses the psutil library and some internal code to get information from your system. -.. image:: https://raw.github.com/nicolargo/glances/master/docs/images/screenshot-wide.png +.. image:: images/screenshot-wide.png Get the code ------------ @@ -25,4 +25,4 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` -* :ref:`search` \ No newline at end of file +* :ref:`search`