make fio scripts python3-ready
[fio.git] / doc / conf.py
index 7af5f4eaad088d91d14a6b90004789f8ca1cc265..087a9a11f0c4422160795feb79ef9a0fa36b7505 100644 (file)
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # fio documentation build configuration file, created by
@@ -23,6 +22,9 @@
 
 # -- General configuration ------------------------------------------------
 
+from __future__ import absolute_import
+from __future__ import print_function
+
 # If your documentation needs a minimal Sphinx version, state it here.
 #
 # needs_sphinx = '1.0'
@@ -50,17 +52,38 @@ master_doc = 'index'
 
 # General information about the project.
 project = 'fio'
-copyright = '2016, Jens Axboe <axboe@kernel.dk>'
+copyright = '2017, Jens Axboe <axboe@kernel.dk>'
 author = 'Jens Axboe <axboe@kernel.dk>'
 
 # 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'
+version = '1'
 # The full version, including alpha/beta/rc tags.
-release = '1'
+# release = '1'
+
+def fio_version():
+
+       from os.path import exists, dirname, join
+       wsroot = dirname(dirname(__file__))
+       version_file = join(wsroot, "FIO-VERSION-FILE")
+       if not exists(version_file):
+               version_gen = join(wsroot, "FIO-VERSION-GEN")
+               from subprocess import call
+               rc = call(version_gen, shell=True, cwd=wsroot)
+               if rc:
+                       print("Couldn't generate version file. rc=%r" % rc)
+                       return "Unknown", "Unknown"
+
+       vsl = open(version_file).read().strip().split('-')
+       version = vsl[1]
+       release = '-'.join(vsl[1:])
+       return version, release
+
+version, release = fio_version()
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -81,7 +104,7 @@ language = None
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 # This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+exclude_patterns = ['output', 'Thumbs.db', '.DS_Store', 'fio_examples.rst']
 
 # The reST default role (used for this markup: `text`) to use for all
 # documents.
@@ -302,7 +325,7 @@ latex_documents = [
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    (master_doc, 'fio', 'fio Documentation',
+    ('fio_man', 'fio', 'flexible I/O tester',
      [author], 1)
 ]