sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
524 stars 75 forks source link

Support custom path for sphinx-build #58

Closed bachp closed 3 years ago

bachp commented 6 years ago

Currently sphinx-autobuild expects sphinx-build to be in PATH.

One way to support a custom path would be to honor the SPHINXBUILD environment variable.

superwhoopy commented 6 years ago

A side-effect is that if sphinx-autobuild is installed in a virtualenv, it cannot be called "directly"' for instance if your root Makefile defines this targe:

livehtml:
   $(VIRTUALENV_PATH)/bin/sphinx-autobuild -b html $(DOC_SRC) $(DOC_BUILD)

it will try to call sphinx-build from PATH - and ultimately fail if Sphinx is only installed in the virtualenv.

I've made a (rather stupid) patch, where I call the Sphinx API directly rather than using Popen(), if you're interested.

EDIT : what I've done is pretty much the same as #61; I simply call sphinx.main() directly rather than forking a new python interpreter.

rowanG077 commented 6 years ago

I have implemented this feature: https://github.com/rowanG077/sphinx-multibuild

pradyunsg commented 3 years ago

Sounds like a good idea!

pradyunsg commented 3 years ago

In #82, we'll start depending on sphinx directly, and use that version via sys.executable. That stops this project from depending on PATH as well as allowing it to work in virtualenvs as described here!

Thanks for reporting this issue, and for the suggestions here! ^>^