Skip to content

Commit

Permalink
Build: Fix Makefile to work on systems without which(1) (GH-416)
Browse files Browse the repository at this point in the history
Replace the use of third-party `which(1)` executable with the shell
`command -v` builtin.  This avoids unnecessary dependency
on a third-party executable, in favor of a shell builtin that is
guaranteed by POSIX, and therefore fixes building documentation
on systems that no longer installs `which(1)` by default,
such as Gentoo Linux.
  • Loading branch information
mgorny committed Apr 1, 2024
1 parent 3c6c891 commit 24dafd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ ftest_inplace: inplace
$(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS)

apidoc: apidocclean inplace
@[ -x "`which sphinx-apidoc`" ] \
@[ -x "`command -v sphinx-apidoc`" ] \
&& (echo "Generating API docs ..." && \
PYTHONPATH=src:$(PYTHONPATH) sphinx-apidoc -e -P -T -o doc/api src/lxml \
"*includes" "*tests" "*pyclasslookup.py" "*usedoctest.py" "*html/_html5builder.py" \
"*.so" "*.pyd") \
|| (echo "not generating Sphinx autodoc API rst files")

apihtml: apidoc inplace
@[ -x "`which sphinx-build`" ] \
@[ -x "`command -v sphinx-build`" ] \
&& (echo "Generating API docs ..." && \
make -C doc/api html) \
|| (echo "not generating Sphinx autodoc API documentation")
Expand All @@ -140,7 +140,7 @@ s5:

apipdf: apidoc inplace
rm -fr doc/api/_build
@[ -x "`which sphinx-build`" ] \
@[ -x "`command -v sphinx-build`" ] \
&& (echo "Generating API PDF docs ..." && \
make -C doc/api latexpdf) \
|| (echo "not generating Sphinx autodoc API PDF documentation")
Expand Down

0 comments on commit 24dafd3

Please sign in to comment.