]> git.scottworley.com Git - pinch/commitdiff
Use xdg packge to find XDG cache dir
authorScott Worley <scottworley@scottworley.com>
Sat, 23 May 2020 00:25:24 +0000 (17:25 -0700)
committerScott Worley <scottworley@scottworley.com>
Sat, 23 May 2020 00:25:24 +0000 (17:25 -0700)
pinch.py
shell.nix

index a7d5b65dc6af1b58625f2a9ab1801629bb67fc67..18272814951a1b2c5ce70374835766331522d8d2 100644 (file)
--- a/pinch.py
+++ b/pinch.py
@@ -25,6 +25,9 @@ from typing import (
     Tuple,
 )
 
     Tuple,
 )
 
+import xdg
+
+
 Digest16 = NewType('Digest16', str)
 Digest32 = NewType('Digest32', str)
 
 Digest16 = NewType('Digest16', str)
 Digest32 = NewType('Digest32', str)
 
@@ -216,9 +219,9 @@ def fetch_resources(v: Verification, channel: Channel) -> None:
 
 
 def git_cachedir(git_repo: str) -> str:
 
 
 def git_cachedir(git_repo: str) -> str:
-    # TODO: Consider using pyxdg to find this path.
-    return os.path.expanduser(
-        '~/.cache/pinch/git/%s' %
+    return os.path.join(
+        xdg.XDG_CACHE_HOME,
+        'pinch/git',
         digest_string(
             git_repo.encode()))
 
         digest_string(
             git_repo.encode()))
 
index b408ea4ba330739becfe23b5d71ed5ae0e6d1310..11e4f03df38198bcabaed52cabc35697a9beb716 100644 (file)
--- a/shell.nix
+++ b/shell.nix
@@ -1,7 +1,7 @@
 { pkgs ? import <nixpkgs> { } }:
 pkgs.mkShell rec {
   doCheck = true;
 { pkgs ? import <nixpkgs> { } }:
 pkgs.mkShell rec {
   doCheck = true;
-  buildInputs = with pkgs; [ python3 ];
+  buildInputs = with pkgs; [ (python3.withPackages (ps: with ps; [ xdg ])) ];
   checkInputs = with pkgs; [
     mypy
     python3Packages.autopep8
   checkInputs = with pkgs; [
     mypy
     python3Packages.autopep8