Sphinx: quickstart makefile error catch for "Command not found" not working correctly.

Created on 3 May 2016  ·  9Comments  ·  Source: sphinx-doc/sphinx

I have my dev setup running on 2 different machines, and recently started to dabble with Sphinx. When I swapped machines, I forgot to install sphinx on the 2nd machine.
Instead of being told that the sphinx-build command was not found though, I got the most mysterious (well, I'm not good with Makefiles) error:

(stable)└─❱❱❱ make html                                                          1 ⏎  +5137 16:45 ❰─┘
Makefile:12: *** commands commence before first target.  Stop.

After looking at line 12:

    $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then 

it dawned on me, that I forgot to install sphinx on this machine. But I guess one would want this error reporting to work better?
I wondered if this were caused by me using zsh, but switching to /bin/bash did not make it better.

For your convenience, I copy the first lines of the Makefile here (which is the exact one created by the sphinx-quickstart script) for your review:

# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
PAPER         =
BUILDDIR      = _build

# 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
bug cmdline help wanted

Most helpful comment

Hi! Personally I think Makefiles are just fine and this one does its job nicely, no need to reinvent the wheel to have everything in python.

But the error message makes things actually harder with BSD make (including Macs) so I think #1024 should just be reverted.

Thanks!

EDIT: the error without #1024 is just

sphinx-build -b html -d _build/doctrees   . _build/html
make: sphinx-build: No such file or directory
make: *** [html] Error 1

it looks fine to me.

All 9 comments

Sorry for inconvenience. This comes from #1024. It seems this is unexpected behavior.
But I don't know the good way to fix this.
@techtonik @shimizukawa Do you have any idea to fix this error?

Thanks,

The feature depends on GNU make functionality, so it doesn't work with BSD make.
IMO, we should remove the friendly message to keep simple. Simple way is not friendly than now, but it is not confusable.

Those system-dependent runners should be replaced by Python script.

I don't know why there is Makefile dependency at all. If somebody needs cross-platform Pythonic solution, it is better use SCons etc.

Hi! Personally I think Makefiles are just fine and this one does its job nicely, no need to reinvent the wheel to have everything in python.

But the error message makes things actually harder with BSD make (including Macs) so I think #1024 should just be reverted.

Thanks!

EDIT: the error without #1024 is just

sphinx-build -b html -d _build/doctrees   . _build/html
make: sphinx-build: No such file or directory
make: *** [html] Error 1

it looks fine to me.

Hi all,
Finally, I reverted #1024 and keep makefile simple.

Thank you for your comments.

@tk0miya did you revered make.bat changes? Why?

I think there is no reason to revert make.bat. Because this problem is caused from combination of BSD make and Makefile. make.bat is not related.

Yup, make.bat looks unrelated. Sorry for the confusion!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scolby33 picture scolby33  ·  3Comments

pgjones picture pgjones  ·  3Comments

jessetan picture jessetan  ·  3Comments

ubershmekel picture ubershmekel  ·  3Comments

shimizukawa picture shimizukawa  ·  3Comments