From: Bruno Haible Date: Mon, 22 Apr 2024 11:11:05 +0000 (+0200) Subject: gnulib-tool.py: Fix trouble caused by Python's bytecode cache. X-Git-Tag: v1.0~18 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=eda62139d838f53e4953db26019e5a4b8b805847;p=gnulib.git gnulib-tool.py: Fix trouble caused by Python's bytecode cache. Reported by Paul Eggert in . * gnulib-tool.py: Set PYTHONPYCACHEPREFIX, so as to avoid creating a __pycache__ directory in the developer's gnulib checkout (only effective with Python ≥ 3.8). --- diff --git a/ChangeLog b/ChangeLog index b3cef64936..4a272d326e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-04-22 Bruno Haible + + gnulib-tool.py: Fix trouble caused by Python's bytecode cache. + Reported by Paul Eggert in + . + * gnulib-tool.py: Set PYTHONPYCACHEPREFIX, so as to avoid creating a + __pycache__ directory in the developer's gnulib checkout (only effective + with Python ≥ 3.8). + 2024-04-21 Collin Funk gnulib-tool.py: Make temporary directories recognizable. diff --git a/gnulib-tool.py b/gnulib-tool.py index cdcd316909..81537c272c 100755 --- a/gnulib-tool.py +++ b/gnulib-tool.py @@ -144,6 +144,12 @@ else func_fatal_error "python3 not found; try setting GNULIB_TOOL_IMPL=sh" fi +# Tell Python to store the compiled bytecode outside the gnulib directory. +if test -z "$PYTHONPYCACHEPREFIX"; then + PYTHONPYCACHEPREFIX="${TMPDIR-/tmp}/gnulib-python-cache-${USER-$LOGNAME}" + export PYTHONPYCACHEPREFIX +fi + profiler_args= # For profiling, cf. . #profiler_args="-m cProfile -s tottime"