[SCM] morituri/master: Update getCache to take name. Add getReadCaches

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:10:00 UTC 2014


The following commit has been merged in the master branch:
commit 1adc97452f699314a5b615e4cd8a953ee6c19309
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Feb 3 22:17:19 2013 +0100

    Update getCache to take name.  Add getReadCaches

diff --git a/morituri/common/directory.py b/morituri/common/directory.py
index 1ad4765..66fb510 100644
--- a/morituri/common/directory.py
+++ b/morituri/common/directory.py
@@ -39,7 +39,7 @@ class Directory(log.Loggable):
         return path
 
 
-    def getCache(self):
+    def getCache(self, name=None):
         try:
             from xdg import BaseDirectory
             path = BaseDirectory.save_cache_path('morituri')
@@ -49,6 +49,33 @@ class Directory(log.Loggable):
             if not os.path.exists(path):
                 os.makedirs(path)
             self.info('Not using XDG, cache directory is %s' % path)
+
+        if name:
+            path = os.path.join(path, name)
+            if not os.path.exists(path):
+                os.makedirs(path)
+
         return path
 
+    def getReadCaches(self, name=None):
+        paths = []
+
+        try:
+            from xdg import BaseDirectory
+            path = BaseDirectory.save_cache_path('morituri')
+            self.info('For XDG, read cache directory is %s' % path)
+            paths.append(path)
+        except ImportError:
+            pass
+
+        path = os.path.expanduser('~/.morituri/cache')
+        if os.path.exists(path):
+            self.info('From before XDG, read cache directory is %s' % path)
+            paths.append(path)
+
+        if name:
+            paths = [os.path.join(p, name) for p in paths]
+
+        return paths
+
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list