From 663599abe9b1026123ddf5e4acf898b2d7a2001a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 29 Mar 2013 11:17:04 +0100 Subject: [PATCH] quickstart: simplify the check for the "sphinx-build" command in the Makefile The previous check called the "sphinx-build" executable on every invocation of the Makefile, which takes a nontrivial time to import all required modules. Calling "which" is much faster. --- sphinx/quickstart.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index bfc6d723b..d9c5c2112 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -389,19 +389,14 @@ SPHINXBUILD = sphinx-build PAPER = BUILDDIR = %(rbuilddir)s -ifeq ($(shell $(SPHINXBUILD) 2> /dev/null; echo $$?), 127) -define MSG - - -The 'sphinx-build' command was not found. Make sure you have Sphinx -installed, then set the SPHINXBUILD environment variable to point -to the full path of the 'sphinx-build' executable. Alternatively you -may add the Sphinx directory to PATH. - -If you don't have Sphinx installed, grab it from -http://sphinx-doc.org/ -endef -$(error $(MSG)) +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error \ +The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx \ +installed, then set the SPHINXBUILD environment variable to point \ +to the full path of the '$(SPHINXBUILD)' executable. Alternatively you \ +can add the directory with the executable to your PATH. \ +If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables.