]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
doc: attempt to parse version if not in environment
authorJason Ish <ish@unx.ca>
Wed, 28 Sep 2016 21:25:48 +0000 (15:25 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 3 Oct 2016 06:52:15 +0000 (08:52 +0200)
Should fix the version displayed on readthedocs.

doc/userguide/conf.py

index e16144cb85c05943c7021caec6a712817607be9f..219dfd15798c67e793abd29a5b57c7d143da77d5 100644 (file)
@@ -15,6 +15,7 @@
 import sys
 import os
 import shlex
+import re
 
 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
 
@@ -57,8 +58,18 @@ author = u'OISF'
 # built documents.
 #
 # The short X.Y version.
-version = os.environ.get('version', "unknown")
-# The full version, including alpha/beta/rc tags.
+
+# Attempt to extract the version configure.ac.
+try:
+    version = os.environ.get('version', None)
+    if not version:
+        version = re.search(
+            "AC_INIT\(suricata,\s*(.*)?\)",
+            open("../../configure.ac").read()).groups()[0]
+    if not version:
+        version = "unknown"
+except:
+    version = "unknown"
 release = version
 
 # The language for content autogenerated by Sphinx. Refer to documentation