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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-10-22 17:08:18 -07:00 committed by James Valleroy
parent eb91938963
commit 8734d96ce9
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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