sphinxcontrib-versioning: Build fails for release and forks, advice?
Hi!
I understand that the status of sphinxcontrib-versioning is a bit complicated, but I gather from reading from the issues and PRs and from looking at a few doc setups that people have this working. I was wondering if someone could help me with an issue I haven’t found reported here on the repo.
Running sphinx-versioning build with the pypi version I get the error documented in issue #66 fixed in PR #69. However, running @z00sts’ PR branch quits with a file not found error.
I’ve also tried @leokoppel’s fork, but there it hangs after two runs of doc building and no files found in the reported path (/tmp/tmp*sphinxcontrib_versioning).
Anyone encountered something similar or could give some points towards getting this to work with compas-dev/compas?
General info
$ python --version
Python 3.6.9
$ pip freeze | grep -i sphinx
nbsphinx==0.4.3
Sphinx==2.2.0
sphinx-compas-theme==0.4.1
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
sphinxcontrib-versioning==2.2.1
$ git remote -v
origin git@github.com:compas-dev/compas.git (fetch)
origin git@github.com:compas-dev/compas.git (push)
Logs
$ pip install git+https://github.com/z00sts/sphinxcontrib-versioning.git@python3.6-import-error-workaround
$ sphinx-versioning -L build -i -r master docs /dist/docs
=> Gathering info about the remote git repository...
=> Getting list of all remote branches/tags...
=> Found: docs-pull-req footnote-fix master patch-1 pathlib_support quick-fix-clr-pythonnet sphinx-versioning update_robot worbit-patch-1 0.1.0 0.1.0-drx_numpy_callback 0.1.0-facenetwork_import 0.1.0-subd_ck_example_imports 0.1.0-viewer_glut_title_str 0.1.1 0.1.1-import_error_smoothing_cpp 0.1.1-import_problems_cpp_versions 0.1.1-leaves_after_embedding 0.1.1-rhino_utility_aliases 0.1.1-xfunc_callback_args 0.1.1_ga_bugfix v0.3.0 v0.3.1 v0.3.2 v0.3.3 v0.3.4 v0.3.5 v0.3.6 v0.4.0 v0.4.1 v0.4.10 v0.4.11 v0.4.12 v0.4.13 v0.4.14 v0.4.15 v0.4.16 v0.4.17 v0.4.18 v0.4.19 v0.4.2 v0.4.20 v0.4.21 v0.4.22 v0.4.23 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.4.7 v0.4.8 v0.4.9 v0.5.0 v0.5.1 v0.5.2 v0.6.0 v0.6.1 v0.6.2 v0.7.0 v0.7.1 v0.7.2
=> With docs: docs-pull-req footnote-fix master patch-1 pathlib_support quick-fix-clr-pythonnet sphinx-versioning update_robot worbit-patch-1 v0.3.0 v0.3.1 v0.3.2 v0.3.3 v0.3.4 v0.3.5 v0.3.6 v0.4.0 v0.4.1 v0.4.10 v0.4.11 v0.4.12 v0.4.13 v0.4.14 v0.4.15 v0.4.16 v0.4.17 v0.4.18 v0.4.19 v0.4.2 v0.4.20 v0.4.21 v0.4.22 v0.4.23 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.4.7 v0.4.8 v0.4.9 v0.5.0 v0.5.1 v0.5.2 v0.6.0 v0.6.1 v0.6.2 v0.7.0 v0.7.1 v0.7.2
=> Root ref is: master
=> Pre-running Sphinx to collect versions' master_doc and other info.
usage: sphinx-versioning [OPTIONS] SOURCEDIR OUTPUTDIR [FILENAMES...]
sphinx-versioning: error: cannot find files ['/tmp/tmpm9pm2hi8sphinxcontrib_versioning']
=> sphinx-build failed for branch/tag: master
Failure.
$ pip install git+https://github.com/leokoppel/sphinxcontrib-versioning
$ sphinx-versioning -L build -i -r master docs /dist/docs
=> Gathering info about the remote git repository...
=> Getting list of all remote branches/tags...
[...]
# Runs twice with Sphinx-warnings that we see with normal runs
[...]
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 27 warnings.
The HTML pages are in ../../../../tmp/tmplibvh55lsphinxcontrib_versioning.
# Freezes
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 5
- Comments: 27
Commits related to this issue
- Update sphinx_.py Fixes from https://github.com/sphinx-contrib/sphinxcontrib-versioning/issues/70#issuecomment-554632618 — committed to joopert/sphinxcontrib-versioning by joopert 5 years ago
- Update sphinx_.py Fixes from https://github.com/sphinx-contrib/sphinxcontrib-versioning/issues/70#issuecomment-554632618 — committed to joopert/sphinxcontrib-versioning by joopert 5 years ago
Hi Anton !
I encountered the same problem with the sphinxcontrib-versioning 2.2.1 from pypi. Even if I solved my problem in #66 I’m still stuck like you mentioned above.
I’ve been hit by this as well and tried to figure out what broke in which sphinx versions. I’ve used the Docker sphinx that I maintain for this and used the “quick-and-dirty” documentation from the tutorial for testing.
argv[1:]fix mentioned above in addition to #46Version 2.0.1 is the first version where I observed the hang/freeze. Apart from the sphinx version, there are no other differences between my Docker images for 2.0.0 and 2.0.1. The changes between those two don’t provide any clue, to me at least, what might have triggered this.
It took me a while but I finally figured it out for good.
I will not make a PR because I find the fix to be especially ugly but I leave it there as a git patch for those encountering the issue.
The bug happens starting from Sphinx 2.0.1 as some noticed and is due to the fact that the
CONFIG_FILENAMEattribute of thesphinx.applicationmodule was deprecated with a 3.0.0 deletion in mind. Now the Sphinx deprecation helper actually wrap the entire module insys.modulesinto a_ModuleWrapperto wrap the module__getattribute__to send aDeprecationWarningif the deprecated attribute is to be fetch. This is all good and all but it does breaks the attempt thatsphinxcontrib.versioningmakes to monkey patch thesphinx.application.Configobject to auto-registersphinxcontrib.versioning.sphinx_as an extension (which actually fixes the hang as previous comments found out) upon instantiation.My UGLY hotfix bypasses the
_ModuleWrapperexplicitly and will not work for sphinx versions before the 2.0.1 and after at least the 3.0.0.@GlitchyPSIX I’ve resorted to conditionally added the extension based on an environment variable. Since I normally only want to run
sphinx-versionsingin CI (andsphinx-buildduring “development” of the documentation), I have added it like soWorks For Me 😄
I’m aware of your work around but that doesn’t solve thing for documentation versions that have already been committed and pushed 😢
@dlopezlo Yes (sphinx 2.2.1), I have managed to get sphinxcontrib-versioning building properly by applying #46, #66, and the
argv[1:]fix (I did them in this order)Do remember to add the
sphinxcontrib.versioning.sphinx_extension inconf.pyI made a separate
conf.pyfor when I want to build separately without versioning which doesn’t have that extension which I build usingsphinx-buildHi there, after digging around for 1 hour, I found a simple hack should work for this case.
https://github.com/sphinx-contrib/sphinxcontrib-versioning/blob/86a28dc92ce3ff42ed36a8b3e4dc6bdcff90f2c4/sphinxcontrib/versioning/sphinx_.py#L202
Change the
argvtoargv[1:].Currently by default
argvhas three elements:sphinx-build,{SOURCE},{TARGET}. But I suspect the new sphinx accepts only the last two, it will treat{TARGET}asfilenameoption and check if it’s really a file, which is a folder of course (Here’s the logging lineNot files).