configure: Do not leave sphinx in-tree artifacts
When ./configure checks the sphinx version is new enough, it leaves the docs/sphinx/__pycache__/ directory. Avoid this by using the '-B' option (don't write .py[co] files on import) via the PYTHONDONTWRITEBYTECODE environment variable.
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -4936,7 +4936,7 @@ has_sphinx_build() { # sphinx-build doesn't exist at all or if it is too old. mkdir -p "$TMPDIR1/sphinx" touch "$TMPDIR1/sphinx/index.rst" - "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 + PYTHONDONTWRITEBYTECODE=yes "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 } # Check if tools are available to build documentation.
Signature · 1 line
2.21.1
Quoted 8 lines · Philippe Mathieu-Daudé
When ./configure checks the sphinx version is new enough, it leaves the docs/sphinx/__pycache__/ directory. Avoid this by using the '-B' option (don't write .py[co] files on import) via the PYTHONDONTWRITEBYTECODE environment variable.
Reported-by Eric Blake <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
This only happens for an in-tree build, right? I think in that case you're kind of OK with having random stuff left in the source tree... It seems easy enough to suppress them though, so I guess we might as well.
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
When ./configure checks the sphinx version is new enough, it leaves the docs/sphinx/__pycache__/ directory. Avoid this by using the '-B' option (don't write .py[co] files on import) via the PYTHONDONTWRITEBYTECODE environment variable.
Reported-by Eric Blake <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>This only happens for an in-tree build, right?
Correct.
Quoted 4 lines
I think in
that case you're kind of OK with having random stuff left in the source tree... It seems easy enough to suppress them though, so I guess we might as well.
Here is the post where Eric commented it:
https://lists.gnu.org/archive/html/qemu-devel/2020-04/msg00631.html
Quoted 4 lines
thanks
-- PMM
Eric Blake
Reviewed-byQuoted 7 lines · Peter Maydell
Quoted 6 lines · Philippe Mathieu-Daudé
When ./configure checks the sphinx version is new enough, it leaves the docs/sphinx/__pycache__/ directory. Avoid this by using the '-B' option (don't write .py[co] files on import) via the PYTHONDONTWRITEBYTECODE environment variable.
Quoted 7 lines
Quoted 2 lines
Reported-by Eric Blake <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>This only happens for an in-tree build, right? I think in that case you're kind of OK with having random stuff left in the source tree... It seems easy enough to suppress them though, so I guess we might as well.
It happens in VPATH too - and what's more, in VPATH, it is still creating it under srcdir rather than builddir, which feels like unnecessary pollution. I was trying to prove whether 'make distclean' got us back to a pristine state; this was one of the files that escaped 'make distclean', so our choice is to either add it to the clean rules, or to avoid creating it in the first place. I like the approach of not creating it in the first place :)
That said,
Quoted 1 line
+ PYTHONDONTWRITEBYTECODE=yes "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
is now even a longer line; is it worth adding \-newline to split it up?
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 11 lines · Eric Blake
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
When ./configure checks the sphinx version is new enough, it leaves the docs/sphinx/__pycache__/ directory. Avoid this by using the '-B' option (don't write .py[co] files on import) via the PYTHONDONTWRITEBYTECODE environment variable.
Reported-by Eric Blake <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 8 lines
Quoted 4 lines
This only happens for an in-tree build, right? I think in that case you're kind of OK with having random stuff left in the source tree... It seems easy enough to suppress them though, so I guess we might as well.
It happens in VPATH too - and what's more, in VPATH, it is still creating it under srcdir rather than builddir, which feels like unnecessary pollution. I was trying to prove whether 'make distclean' got us back to a pristine state; this was one of the files that escaped 'make distclean', so our choice is to either add it to the clean rules, or to avoid creating it in the first place. I like the approach of not creating it in the first place :)
Reviewed-by Eric Blake <[email protected]>
Hmm, I spoke early. Your patch only addresses the pollution during './configure'. But running 'make' (even in a VPATH build) equally creates the same pollution. Which means we really ought to be cleaning it up during 'make distclean' rather than just trying to make './configure' clever.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 17 lines · Eric Blake
Quoted 16 lines · Eric Blake
Quoted 14 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
When ./configure checks the sphinx version is new enough, it leaves the docs/sphinx/__pycache__/ directory. Avoid this by using the '-B' option (don't write .py[co] files on import) via the PYTHONDONTWRITEBYTECODE environment variable.
Reported-by Eric Blake <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>This only happens for an in-tree build, right? I think in that case you're kind of OK with having random stuff left in the source tree... It seems easy enough to suppress them though, so I guess we might as well.
Quoted 5 lines
Quoted 3 lines
It happens in VPATH too - and what's more, in VPATH, it is still creating it under srcdir rather than builddir, which feels like unnecessary pollution. I was trying to prove whether 'make distclean' got us back to a pristine state; this was one of the files that escaped 'make distclean', so our choice is to either add it to the clean rules, or to avoid creating it in the first place. I like the approach of not creating it in the first place :)
Reviewed-by Eric Blake <[email protected]>Hmm, I spoke early. Your patch only addresses the pollution during './configure'. But running 'make' (even in a VPATH build) equally creates the same pollution. Which means we really ought to be cleaning it up during 'make distclean' rather than just trying to make './configure' clever.
Oh I only checked ./configure indeed, sorry. Thanks for testing!