-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fallback to temp dir if cache does not exist
This fixes a misbehaviour in environments where `XDG_CACHE_DIR` is not set and `~/.cache` does not exist, e.g. in the docker image. We simply attempt to create a temporary directory which will be registered with `atexit` to be deleted on exit using `shutil.rmtree()`. A Python 3 approach for future would be to use a `TemporaryDirectory` instead which would get cleaned up when the held object gets dropped out of the TLS stack. It is still possible for the `context.cache_dir` to be `None` if the default directory exists but is not writable, which means some code which uses this property is liable to blow up in such a circumstance.
- Loading branch information
1 parent
957a5a5
commit f91003c
Showing
1 changed file
with
63 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters