summaryrefslogtreecommitdiff
path: root/Documentation/conf.py
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2017-04-14 12:38:12 -0700
committerBen Pfaff <blp@ovn.org>2017-04-14 12:39:17 -0700
commit882072d77a2213c28555d39b95259980622cd8e6 (patch)
tree27896aa8734172288d2a2b4208042bba493d9a80 /Documentation/conf.py
parentf654d6e4df5dd5b06fede3a66f68b0480d22ae8c (diff)
downloadopenvswitch-882072d77a2213c28555d39b95259980622cd8e6.tar.gz
doc: Avoid need to generate conf.py.
It's awkward to have to at the same time generate conf.py from conf.py.in and to keep both versions in the repository. This avoids the issue. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r--Documentation/conf.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index ae672cbe7..e32436be5 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -1,4 +1,3 @@
-# Generated automatically -- do not modify! -*- buffer-read-only: t -*-
# -*- coding: utf-8 -*-
#
# Open vSwitch documentation build configuration file, created by
@@ -13,6 +12,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
+import string
+import sys
+
# 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.
@@ -63,10 +65,26 @@ author = u'The Open vSwitch Development Community'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-# The short X.Y version.
-version = u'2.7'
# The full version, including alpha/beta/rc tags.
-release = u'2.7.90'
+release = None
+filename = "../configure.ac"
+with open(filename, 'rU') as f:
+ for line in f:
+ if 'AC_INIT' in line:
+ # Parse "AC_INIT(openvswitch, 2.7.90, bugs@openvswitch.org)":
+ release = line.split(',')[1].strip(string.whitespace + '[]')
+ break
+if release is None:
+ sys.stderr.write('%s: failed to determine Open vSwitch version\n'
+ % filename)
+ sys.exit(1)
+
+# The short X.Y version.
+#
+# However, it's important to know the difference between, e.g., 2.7
+# and 2.7.90, which can be very different versions (2.7.90 may be much
+# closer to 2.8 than to 2.7), so check for that.
+version = release if '.90' in release else '.'.join(release.split('.')[0:2])
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.