sphinx-contrib / sphinxcontrib-versioning

Sphinx extension that allows building versioned docs for self-hosting.
https://sphinxcontrib-versioning.readthedocs.io/en/latest/
MIT License
125 stars 81 forks source link

Sphinx-versioning and Setuptools integration #53

Open deads opened 6 years ago

deads commented 6 years ago

Thanks for an awesome and very useful project!

I have one issue that keeps creeping up. I noticed that sphinx-versioning copies the source code directory to a temporary directory, and then runs sphinx-build. Some projects do not exhibit a working run-time directory structure until setup.py is run and the components are built. In this case, if you copy the source directory, many local imports will fail. For example, my Python package has large C/C++ components with Python classes auto-generated in this process. A much more rudimentary example would be projects that use setuptools to generate a version.py that is then imported locally in __init__.py.

Can you offer an option to build each branch via setup.py? Something along the lines of:

sphinx-versioning --build-cmd `python setup.py build install --prefix $prefixdir`

where $prefixdir is a temp prefix directory that sphinx-versioning runs sphinx-build against for each branch?

Adding support for integration with setuptools will make sphinx-versioning work out of the box with a wider variety of Python projects.