From 422cd22c156eba444fb724bfe70d76fed4881f5b Mon Sep 17 00:00:00 2001
From: Jan Vcelak <jan.vcelak@nic.cz>
Date: Wed, 15 Apr 2015 13:09:35 +0200
Subject: [PATCH] doc: separate Sphinx config for autotools variables

Having these variables in a separate file allows making changes into the
Sphinx configuration file without running './configure'.
---
 .gitignore                  |  4 ----
 configure.ac                |  2 +-
 doc/.gitignore              | 20 ++------------------
 doc/{conf.py.in => conf.py} | 13 ++++++++-----
 doc/conf_autotools.py.in    | 14 ++++++++++++++
 5 files changed, 25 insertions(+), 28 deletions(-)
 rename doc/{conf.py.in => conf.py} (97%)
 create mode 100644 doc/conf_autotools.py.in

diff --git a/.gitignore b/.gitignore
index 3e6358ce2c..48532813be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,7 +92,3 @@
 *.gcno
 /coverage.info
 /coverage.html
-
-# sphinx documentation
-/doc/_build/
-/doc/conf.py
diff --git a/configure.ac b/configure.ac
index c258727e6e..7b7601c968 100644
--- a/configure.ac
+++ b/configure.ac
@@ -407,7 +407,7 @@ AC_CONFIG_FILES([Makefile
 		 src/dnssec/man/knsec3hash.1
 		 src/dnssec/tests/Makefile
 		 src/dnssec/utils/Makefile
-		 doc/conf.py
+		 doc/conf_autotools.py
 		 man/khost.1
 		 man/knotc.8
 		 man/knotd.8
diff --git a/doc/.gitignore b/doc/.gitignore
index 2e11e0e0dc..a42cc8814f 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,18 +1,2 @@
-*.info
-*.pdf
-*.html
-*.dvi
-*.aux
-*.cp
-*.fn
-*.ky
-*.log
-*.pg
-*.toc
-*.tp
-*.vr
-texinfo.tex
-version.texi
-mdate-sh
-stamp-vti
-!/logo.pdf
\ No newline at end of file
+/_build
+/conf_autotools.py
diff --git a/doc/conf.py.in b/doc/conf.py
similarity index 97%
rename from doc/conf.py.in
rename to doc/conf.py
index 70b1cd8736..584cceb85e 100644
--- a/doc/conf.py.in
+++ b/doc/conf.py
@@ -16,10 +16,13 @@ import sys, os, time
 # 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('.'))
+sys.path.insert(0, os.path.abspath('.'))
 
 # -- General configuration -----------------------------------------------------
 
+# variables generated on './configure'
+from conf_autotools import version, release, today
+
 # If your documentation needs a minimal Sphinx version, state it here.
 #needs_sphinx = '1.0'
 
@@ -49,9 +52,9 @@ author = 'CZ.NIC Labs <http://www.knot-dns.cz>'
 # built documents.
 #
 # The short X.Y version.
-version = '@VERSION@'
+#version = ''
 # The full version, including alpha/beta/rc tags.
-release = '@VERSION@'
+#release = ''
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -59,7 +62,7 @@ release = '@VERSION@'
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
-today = '@RELEASE_DATE@'
+#today = False
 # Else, today_fmt is used as the format for a strftime call.
 #today_fmt = '%B %d, %Y'
 
@@ -219,7 +222,7 @@ latex_domain_indices = False
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('reference', 'knot.conf', 'Knot DNS configuration file', author, 5)
+    ('reference', 'knot.conf', 'Knot DNS configuration file', author, 5),
 ]
 
 # If true, show URL addresses after external links.
diff --git a/doc/conf_autotools.py.in b/doc/conf_autotools.py.in
new file mode 100644
index 0000000000..6b4e56fa10
--- /dev/null
+++ b/doc/conf_autotools.py.in
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+#
+# Sphinx options generated by autotools on './configure'.
+#
+
+# The short X.Y version.
+version = '@VERSION@'
+
+# The full version, including alpha/beta/rc tags.
+release = '@VERSION@'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+today = '@RELEASE_DATE@'
-- 
GitLab