Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move default cache root from ~/.shiv to ~/.cache/shiv #242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TomiBelan
Copy link

More precisely:

  1. if $SHIV_ROOT is set, use it
  2. if --root is set, use it
  3. if ~/.shiv already exists, use it
  4. on Windows: %LOCALAPPDATA%\shiv\cache
  5. on macOS: ~/Library/Caches/shiv
  6. on other: $XDG_CACHE_HOME/shiv or ~/.cache/shiv

Motivation:

  • Purely aesthetic reasons :) Less junk in $HOME.
  • The location makes it more obvious that it's just a cache. --> Users should feel free to delete it.
  • Some backup software will ignore caches by default.

Implementation:

This is an ad hoc, informally-specified, bug-ridden, slow implementation of 1% of platformdirs. platformdirs is the most common library for this, for example it is used by pip to locate its own cache (~/.cache/pip). I didn't want to use platformdirs directly because this code is embedded into .pyz files and shouldn't have any dependencies. The main differences from the original platformdirs algorithm are that Windows only checks getenv (not ctypes/windll or registry) (see also), Windows falls back to Unix if getenv fails, and Android is not special cased (see also).

Please test!!:

I don't have a Windows or macOS development setup. I'd be grateful if someone could check that it works, and that the directory is created nearby to pip's cache (probably %LOCALAPPDATA%\pip\cache, ~/Library/Caches/pip).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant