]> git.scottworley.com Git - pinch/blobdiff - pinch.py
Set git user in test harness
[pinch] / pinch.py
index 732a91f645c036a4692e6ea55083cad4427373d0..5d93c262cf192d5ee04e3755da3e50f76b15a997 100644 (file)
--- a/pinch.py
+++ b/pinch.py
@@ -25,7 +25,17 @@ from typing import (
     Tuple,
 )
 
-import xdg
+# Use xdg module when it's less painful to have as a dependency
+
+
+class XDG(types.SimpleNamespace):
+    XDG_CACHE_HOME: str
+
+
+xdg = XDG(
+    XDG_CACHE_HOME=os.getenv(
+        'XDG_CACHE_HOME',
+        os.path.expanduser('~/.cache')))
 
 
 Digest16 = NewType('Digest16', str)
@@ -73,7 +83,7 @@ class Verification:
     def result(self, r: bool) -> None:
         message, color = {True: ('OK ', 92), False: ('FAIL', 91)}[r]
         length = len(message)
-        cols = shutil.get_terminal_size().columns
+        cols = shutil.get_terminal_size().columns or 80
         pad = (cols - (self.line_length + length)) % cols
         print(' ' * pad + self._color(message, color), file=sys.stderr)
         self.line_length = 0
@@ -468,7 +478,7 @@ def git_revision_name(v: Verification, channel: Channel) -> str:
     process = subprocess.run(['git',
                               '-C',
                               git_cachedir(channel.git_repo),
-                              'lo',
+                              'log',
                               '-n1',
                               '--format=%ct-%h',
                               '--abbrev=11',