[27261] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit [krb5-1.11]: Generate and use version.py for Sphinx

daemon@ATHENA.MIT.EDU (Tom Yu)
Fri Nov 16 14:58:31 2012

Date: Fri, 16 Nov 2012 14:58:19 -0500
From: Tom Yu <tlyu@mit.edu>
Message-Id: <201211161958.qAGJwJSY022257@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/8d290c2e310999a241ab6a56ee2b33871cce0eb0
commit 8d290c2e310999a241ab6a56ee2b33871cce0eb0
Author: Tom Yu <tlyu@mit.edu>
Date:   Wed Oct 17 18:12:52 2012 -0400

    Generate and use version.py for Sphinx
    
    Sphinx's idea of the version number appears in the man pages and
    compiled PDF documents, and shows up as metadata in the generated
    HTML sources.
    
    Extract the version information from the master source (patchlevel.h)
    into a form usable by Sphinx.
    
    (cherry picked from commit 07c77b51d33c23d3ea28d588adc43b6c5ec5c20f)
    
    ticket: 7433

 .gitignore            |    2 ++
 doc/conf.py           |   11 ++++++++---
 src/doc/Makefile.in   |   15 ++++++++++++---
 src/doc/version.py.in |   21 +++++++++++++++++++++
 src/man/Makefile.in   |    5 ++++-
 5 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index d1b4bba..36c4f1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@ obj/
 testdir/
 testlog
 
+/doc/version.py
+
 /doc/html/
 
 /src/config.log
diff --git a/doc/conf.py b/doc/conf.py
index fb47f35..fafae15 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -47,11 +47,16 @@ copyright = u'2012, MIT'
 # 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.
-#
+execfile("version.py")
 # The short X.Y version.
-version = '0.0.1'
+r_list = [r_major, r_minor]
+if r_patch:
+    r_list += [r_patch]
+version = '.'.join(map(str, r_list))
 # The full version, including alpha/beta/rc tags.
-release = '0.0.1'
+release = version
+if r_tail:
+    release += '-' + r_tail
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/src/doc/Makefile.in b/src/doc/Makefile.in
index 4fcbb67..2413068 100644
--- a/src/doc/Makefile.in
+++ b/src/doc/Makefile.in
@@ -57,7 +57,7 @@ NOTICE: notice.txt
 # Use doxygen to generate API documentation, translate it into RST
 # format, and then create a composite of $(docsrc)'s RST and the
 # generated files in rst_composite.  Used by the html and substhtml targets.
-composite: Doxyfile
+composite: Doxyfile $(docsrc)/version.py
 	rm -rf doxy rst_apiref rst_composite
 	$(DOXYGEN)
 	cwd=`pwd`; cd $(docsrc)/tools && \
@@ -70,15 +70,17 @@ composite: Doxyfile
 	cp rst_apiref/*.rst rst_composite/appldev/refs/api
 	cp rst_apiref/types/*.rst rst_composite/appldev/refs/types
 	cp rst_apiref/macros/*.rst rst_composite/appldev/refs/macros
+	cp $(docsrc)/version.py rst_composite
 
 # Must use a separate source dir for sphinx text builds, since the text
 # engine cannot handle the row spanning cells in fancy tables that we use
-rst_notice: $(docsrc)/notice.rst $(docsrc)/txt_conf.py
+rst_notice: $(docsrc)/notice.rst $(docsrc)/txt_conf.py $(docsrc)/version.py
 	mkdir -p rst_notice
 	# reST needs backslashes before parens in this macro definition.
 	sed -e 's/include:: <isonum.txt>/|copy| replace:: \\(C\\)/' \
 		< $(docsrc)/notice.rst > rst_notice/notice.rst
 	cp $(docsrc)/txt_conf.py rst_notice/conf.py
+	cp $(docsrc)/version.py rst_notice
 
 Doxyfile: $(srcdir)/Doxyfile.in
 	sed -e 's|@SRC@|$(top_srcdir)|g' \
@@ -95,6 +97,13 @@ paths.py:
 	echo 'keytab = "``$(DEFKTNAME)``"' >> $@
 	echo 'ckeytab = "``$(DEFCKTNAME)``"' >> $@
 
+# Dummy rule that man/Makefile can invoke
+version.py: $(docsrc)/version.py
+
+$(docsrc)/version.py: $(top_srcdir)/patchlevel.h $(srcdir)/version.py.in
+	$(RM) $@
+	$(CC) -E -I$(top_srcdir) - < $(srcdir)/version.py.in > $@
+
 clean::
 	rm -rf doxy rst_apiref rst_composite rst_notice html_subst \
-		Doxyfile paths.py
+		Doxyfile paths.py $(docsrc)/version.py
diff --git a/src/doc/version.py.in b/src/doc/version.py.in
new file mode 100644
index 0000000..0a344a7
--- /dev/null
+++ b/src/doc/version.py.in
@@ -0,0 +1,21 @@
+#include "patchlevel.h"
+
+r_major = KRB5_MAJOR_RELEASE
+r_minor = KRB5_MINOR_RELEASE
+r_patch = KRB5_PATCHLEVEL
+
+#ifdef KRB5_RELTAIL
+r_tail = KRB5_RELTAIL
+#else
+r_tail = None
+#endif
+#ifdef KRB5_RELDATE
+r_date = KRB5_RELDATE
+#else
+r_date = None
+#endif
+#ifdef KRB5_RELTAG
+r_tag = KRB5_RELTAG
+#else
+r_date = None
+#endif
diff --git a/src/man/Makefile.in b/src/man/Makefile.in
index 895b5c1..19617ee 100644
--- a/src/man/Makefile.in
+++ b/src/man/Makefile.in
@@ -24,7 +24,7 @@ docsrc=$(top_srcdir)/../doc
 #     make -f Makefile.in clean
 # The sed command deletes some trailing whitespace that the docutils
 # manpage writer outputs near the end of its output files.
-man:
+man: $(docsrc)/version.py
 	rm -rf rst_man
 	$(SPHINX_BUILD) -q -t mansubs -b man $(docsrc) rst_man
 	for f in rst_man/*.[0-9]; do \
@@ -32,6 +32,9 @@ man:
 		sed -e '/^\.\\" $$/d' $$f > $(srcdir)/$$name.man; \
 	done
 
+$(docsrc)/version.py: $(top_srcdir)/patchlevel.h
+	(cd $(BUILDTOP)/doc && make version.py)
+
 .SUFFIXES: .man .sub
 
 .man.sub:
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post