aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-19 19:38:46 -0400
committerJack Lloyd <[email protected]>2017-09-19 19:38:46 -0400
commit2fdd4577989e259874cf49952d96ab02d3c5b690 (patch)
tree0c2f307c2461692f81b2b0298c05fa199dce74ce /src
parent441a70b1fa98e1f1310d70f6b9f662ab72cbada0 (diff)
Load botan_version.py as a file instead of as module import
Really no reason for this to be arbitrary code
Diffstat (limited to 'src')
-rw-r--r--src/configs/sphinx/conf.py (renamed from src/build-data/sphinx/conf.py)46
-rw-r--r--src/configs/sphinx/templates/layout.html (renamed from src/build-data/sphinx/templates/layout.html)0
2 files changed, 29 insertions, 17 deletions
diff --git a/src/build-data/sphinx/conf.py b/src/configs/sphinx/conf.py
index 91cfd3bc9..7d968f21b 100644
--- a/src/build-data/sphinx/conf.py
+++ b/src/configs/sphinx/conf.py
@@ -1,15 +1,10 @@
# Sphinx configuration file
-import sys, os
+import sys
+import ast
+import re
-# Avoid useless botan_version.pyc (Python 2.6 or higher)
-if 'dont_write_bytecode' in sys.__dict__:
- sys.dont_write_bytecode = True
-
-sys.path.insert(0, os.path.join(os.pardir, os.pardir, os.pardir))
-
-import sphinx
-import botan_version
+#import sphinx
def check_for_tag(tag):
# Nasty hack :(
@@ -20,6 +15,26 @@ def check_for_tag(tag):
except ValueError:
return False
+
+def parse_version_file(version_path):
+ version_file = open(version_path)
+ key_and_val = re.compile(r"([a-z_]+) = ([a-zA-Z0-9\']+)")
+
+ results = {}
+ for line in version_file.readlines():
+ if not line or line[0] == '#':
+ continue
+ match = key_and_val.match(line)
+ if match:
+ results[match.group(1)] = ast.literal_eval(match.group(2))
+ return results
+
+version_info = parse_version_file('../../../botan_version.py')
+
+version_major = version_info['release_major']
+version_minor = version_info['release_minor']
+version_patch = version_info['release_patch']
+
is_website_build = check_for_tag('website')
needs_sphinx = '1.1'
@@ -55,11 +70,8 @@ master_doc = 'contents'
project = u'botan'
copyright = u'2000-2017, The Botan Authors'
-version = '%d.%d' % (botan_version.release_major, botan_version.release_minor)
-
-release = '%d.%d.%d' % (botan_version.release_major,
- botan_version.release_minor,
- botan_version.release_patch)
+version = '%d.%d' % (version_major, version_minor)
+release = '%d.%d.%d' % (version_major, version_minor, version_patch)
#today = ''
today_fmt = '%Y-%m-%d'
@@ -184,9 +196,10 @@ htmlhelp_basename = 'botandoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
+
+authors = u'Jack Lloyd \\and Daniel Neus \\and Ren\u00e9 Korthaus \\and Juraj Somorovsky \\and Tobias Niemann'
latex_documents = [
- ('contents', 'botan.tex', u'Botan Reference Manual',
- u'Jack Lloyd \\and Daniel Neus \\and Ren\u00e9 Korthaus \\and Juraj Somorovsky \\and Tobias Niemann', 'manual'),
+ ('contents', 'botan.tex', u'Botan Reference Manual', authors, 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -211,4 +224,3 @@ latex_show_urls = 'inline'
# If false, no module index is generated.
latex_domain_indices = False
-
diff --git a/src/build-data/sphinx/templates/layout.html b/src/configs/sphinx/templates/layout.html
index c907c7597..c907c7597 100644
--- a/src/build-data/sphinx/templates/layout.html
+++ b/src/configs/sphinx/templates/layout.html