From 8734d96ce9ca9161af3d8c5d1fdf9cb85458bcfb Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 22 Oct 2019 17:08:18 -0700 Subject: [PATCH] doc: Install using makefile instead of setup.py - Prevent unnecessary copying and shipping of .xml files. - Run multiple jobs concurrently to speed up the process. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- doc/Makefile | 12 +++++++++++- setup.py | 12 ++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 3470b7632..8b79602d3 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -24,12 +24,16 @@ MANUAL_URL="https://wiki.debian.org/{lang-fragment}FreedomBox/Manual?action=show MANUAL_URL_RAW="https://wiki.debian.org/{lang-fragment}FreedomBox/Manual?action=raw" MANUAL_PAGE_URL="https://wiki.debian.org/{lang-fragment}FreedomBox/Manual/{page}?action=show&mimetype=text%2Fdocbook" +DESTDIR= +INSTALL_DIR=$(DESTDIR)/usr/share/doc/freedombox SCRIPTS_DIR=scripts manual-pdfs=$(foreach lang,$(MANUAL_LANGUAGES),manual/$(lang)/freedombox-manual.pdf) manual-xmls=$(patsubst %.pdf,%.xml,$(manual-pdfs)) OUTPUTS=$(manual-pdfs) plinth.1 manual-pages +INSTALL_OPTS=-D --mode=644 + # In order to debug various problems with the documents especially # intermediate LaTeX state, run make as follows: # @@ -42,9 +46,15 @@ ifneq ($(DEBUG),) XMLTO_DEBUG_FLAGS=--noclean -p '--debug' endif -.PHONY: all +.PHONY: all install all: $(OUTPUTS) +install: all + for file in $(manual-pages-part-html) $(manual-pdfs); do \ + install $(INSTALL_OPTS) -t $(INSTALL_DIR)/$$(dirname $${file}) \ + $${file} ; \ + done + # Do not edit the manual page in this directory. The manual is # maintained as separate pages on the FreedomBox wiki and aggregated # into a single page using the MoinMoin include feature. Then it is diff --git a/setup.py b/setup.py index 339f9a346..8bae788a7 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,6 @@ DIRECTORIES_TO_CREATE = [ ] DIRECTORIES_TO_COPY = [ - ('/usr/share/doc/freedombox', 'doc'), ('/usr/share/plinth/static', 'static'), ] @@ -151,9 +150,18 @@ class CustomInstall(install): class CustomInstallData(install_data): """Override install command to allow directory creation and copy""" + def _run_doc_install(self): + """Install documentation""" + command = ['make', '-j', '8', '-C', 'doc', 'install'] + if self.root: + root = os.path.abspath(self.root) + command.append(f'DESTDIR={root}') + + subprocess.check_call(command) + def run(self): """Execute install command""" - subprocess.check_call(['make', '-C', 'doc']) + self._run_doc_install() install_data.run(self) # Old style base class