]> granicus.if.org Git - python/commit
bpo-33499: Add PYTHONPYCACHEPREFIX env var for alt bytecode cache location. (GH-6834)
authorCarl Meyer <carl@oddbird.net>
Sat, 16 Jun 2018 04:40:56 +0000 (22:40 -0600)
committerNick Coghlan <ncoghlan@gmail.com>
Sat, 16 Jun 2018 04:40:56 +0000 (14:40 +1000)
commitb193fa996a746111252156f11fb14c12fd6267e6
tree1995957ce580ba762a19f64e41db2db32aec096a
parent68680035143a3a6398faa88f067f244c74691d19
bpo-33499: Add PYTHONPYCACHEPREFIX env var for alt bytecode cache location. (GH-6834)

In some development setups it is inconvenient or impossible to write bytecode
caches to the code tree, but the bytecode caches are still useful. The
PYTHONPYCACHEPREFIX environment variable allows specifying an alternate
location for cached bytecode files, within which a directory tree mirroring the code
tree will be created. This cache tree is then used (for both reading and writing)
instead of the local `__pycache__` subdirectory within each source directory.

Exposed at runtime as sys.pycache_prefix (defaulting to None), and can
be set from the CLI as "-X pycache_prefix=path".

Patch by Carl Meyer.
12 files changed:
Doc/library/compileall.rst
Doc/library/sys.rst
Doc/using/cmdline.rst
Include/pystate.h
Lib/importlib/_bootstrap_external.py
Lib/test/test_cmd_line.py
Lib/test/test_importlib/test_util.py
Lib/test/test_importlib/util.py
Misc/NEWS.d/next/Core and Builtins/2018-05-15-10-48-47.bpo-33499.uBEc06.rst [new file with mode: 0644]
Modules/main.c
Python/importlib_external.h
Python/sysmodule.c