Skip to content

Commit

Permalink
Switch to 'platformdirs' for resolving cache dir. Fixes #64.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 27, 2022
1 parent e1e7a89 commit 4ebfe1b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v9.4.0
======

#64: Switch to ``platformdirs`` for resolving the cache dir.

v9.3.0
======

Expand Down
3 changes: 1 addition & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def alt_cache_dir(monkeypatch_session, tmp_path_factory):
alt_cache = tmp_path_factory.mktemp('cache')

class Paths:
user_cache = alt_cache
user_cache_dir = alt_cache
user_cache_path = alt_cache

monkeypatch_session.setattr(pip_run.persist, 'paths', Paths)

Expand Down
6 changes: 3 additions & 3 deletions pip_run/persist.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import hashlib
import contextlib

import app_paths
import platformdirs

from . import deps


paths = app_paths.AppPaths.get_paths(appname='pip run', appauthor=False)
paths = platformdirs.PlatformDirs(appname='pip run', appauthor=False)


class Hash:
Expand Down Expand Up @@ -51,4 +51,4 @@ def cache_key(args):

@contextlib.contextmanager
def context(args):
yield paths.user_cache.joinpath(cache_key(args))
yield paths.user_cache_path.joinpath(cache_key(args))
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ install_requires =
more_itertools >= 8.3
jaraco.context
jaraco.text
app_paths
platformdirs

[options.packages.find]
exclude =
Expand Down

0 comments on commit 4ebfe1b

Please sign in to comment.