From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 8/9] build: generate man page list from source files, not conf.py
Date: Sat, 5 Nov 2016 22:18:17 +0200 [thread overview]
Message-ID: <fc183ba0bcef40dc510c0f83677b19158e55844d.1478376896.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1478376896.git.jani@nikula.org>
In-Reply-To: <cover.1478376896.git.jani@nikula.org>
Use $(wildcard ...) to generate the list of man pages based on the rst
source files present in the man page directories, instead of reading
conf.py. This has three main benefits:
1) This makes the man page build slightly less complicated and easier
to understand. At least there are fewer moving parts.
2) This makes the build fail if we add a man page rst file, but fail
to add it to conf.py.
3) We can use Sphinx constructs in conf.py that are not available when
importing the file into a normal python program such as
mkdocdeps.py.
---
doc/.gitignore | 1 -
doc/Makefile.local | 23 +++++++++++++----------
doc/mkdocdeps.py | 18 ------------------
3 files changed, 13 insertions(+), 29 deletions(-)
delete mode 100644 doc/mkdocdeps.py
diff --git a/doc/.gitignore b/doc/.gitignore
index d0da78e510f1..9fa35d08a95e 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,4 +1,3 @@
*.pyc
-docdeps.mk
_build
config.dox
diff --git a/doc/Makefile.local b/doc/Makefile.local
index 5dc1cad489cc..8a2f656bcad4 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -7,13 +7,23 @@ SPHINXOPTS := -q
SPHINXBUILD = sphinx-build
DOCBUILDDIR := $(dir)/_build
-mkdocdeps := $(PYTHON) $(srcdir)/$(dir)/mkdocdeps.py
-
# Internal variables.
ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(srcdir)/$(dir)
APIMAN := $(DOCBUILDDIR)/man/man3/notmuch.3
DOXYFILE := $(srcdir)/$(dir)/doxygen.cfg
+MAN1_RST := $(wildcard $(srcdir)/doc/man1/*.rst)
+MAN5_RST := $(wildcard $(srcdir)/doc/man5/*.rst)
+MAN7_RST := $(wildcard $(srcdir)/doc/man7/*.rst)
+MAN_RST_FILES := $(MAN1_RST) $(MAN5_RST) $(MAN7_RST)
+
+MAN1_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN1_RST:.rst=.1))
+MAN5_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN5_RST:.rst=.5))
+MAN7_ROFF := $(patsubst $(srcdir)/doc/%,$(DOCBUILDDIR)/man/%,$(MAN7_RST:.rst=.7))
+MAN_ROFF_FILES := $(MAN1_ROFF) $(MAN5_ROFF) $(MAN7_ROFF)
+
+MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
+
.PHONY: sphinx-html sphinx-texinfo sphinx-info
.PHONY: install-man build-man apidocs install-apidocs
@@ -30,10 +40,6 @@ sphinx-texinfo:
sphinx-info: sphinx-texinfo
make -C $(DOCBUILDDIR)/texinfo info
--include $(dir)/docdeps.mk
-
-MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
-
# Use the man page converter that is available. We should never depend
# on MAN_ROFF_FILES if a converter is not available.
${MAN_ROFF_FILES}: $(DOCBUILDDIR)/.roff.stamp
@@ -96,8 +102,5 @@ $(dir)/config.dox: version.stamp
echo "PROJECT_NAME = \"Notmuch $(VERSION)\"" > $@
echo "INPUT=${srcdir}/lib/notmuch.h" >> $@
-$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
- $(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@
-
-CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(DOCBUILDDIR)/.roff.stamp
+CLEAN := $(CLEAN) $(DOCBUILDDIR) $(DOCBUILDDIR)/.roff.stamp
CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) $(dir)/conf.pyc $(dir)/config.dox
diff --git a/doc/mkdocdeps.py b/doc/mkdocdeps.py
deleted file mode 100644
index b87fe3e80c0f..000000000000
--- a/doc/mkdocdeps.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import sys
-
-srcdir = sys.argv[1]
-builddir = sys.argv[2]
-outfile = sys.argv[3]
-
-sys.path.insert(0, srcdir)
-import conf
-
-roff_files = []
-rst_files = []
-for page in conf.man_pages:
- rst_files = rst_files + ["{0:s}/{1:s}.rst".format(srcdir,page[0])]
- roff_files = roff_files + ["{0:s}/man/{1:s}.{2:d}".format(builddir,page[0],page[4])]
-
-with open(outfile, 'w') as out:
- out.write('MAN_ROFF_FILES := ' + ' \\\n\t'.join(roff_files) + '\n')
- out.write('MAN_RST_FILES := ' + ' \\\n\t'.join(rst_files) + '\n')
--
2.1.4
next prev parent reply other threads:[~2016-11-05 20:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-05 20:18 [PATCH 0/9] doc: config and build improvements Jani Nikula
2016-11-05 20:18 ` [PATCH 1/9] doc/conf.py: add notmuch-emacs-mua to texinfo documents Jani Nikula
2016-11-05 20:18 ` [PATCH 2/9] doc/conf.py: generate texinfo_documents list from man_pages list Jani Nikula
2016-11-05 20:18 ` [PATCH 3/9] doc/conf.py: abstract notmuch authors Jani Nikula
2016-11-05 20:18 ` [PATCH 4/9] doc/conf.py: reindent, whitespace clean man page, texinfo lists Jani Nikula
2016-11-05 20:18 ` [PATCH 5/9] doc/conf.py: include command name in texinfo document title Jani Nikula
2016-11-05 20:18 ` [PATCH 6/9] doc: fix references in notmuch-emacs.rst Jani Nikula
2016-11-05 20:18 ` [PATCH 7/9] build: do not touch roff files after sphinx-build Jani Nikula
2016-11-05 20:18 ` Jani Nikula [this message]
2016-11-05 20:18 ` [PATCH 9/9] build: only install known man pages Jani Nikula
2016-11-16 17:36 ` [PATCH 0/9] doc: config and build improvements Tomi Ollila
2016-11-18 2:19 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc183ba0bcef40dc510c0f83677b19158e55844d.1478376896.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).