File: use-appdirs.patch

package info (click to toggle)
pytools 2014.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 424 kB
  • ctags: 971
  • sloc: python: 4,037; makefile: 14
file content (51 lines) | stat: -rw-r--r-- 2,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Description: Change cache directory is created
Origin: https://github.com/inducer/pytools/commit/eefea8e6012c3d94794f244a245d64bb69169331
Forwarded: https://github.com/inducer/pytools/commit/eefea8e6012c3d94794f244a245d64bb69169331
Applied-Upstream: https://github.com/inducer/pytools/commit/eefea8e6012c3d94794f244a245d64bb69169331
Last-Update: 2014-11-29
Index: pytools-2014.3/pytools/persistent_dict.py
===================================================================
--- pytools-2014.3.orig/pytools/persistent_dict.py
+++ pytools-2014.3/pytools/persistent_dict.py
@@ -238,13 +238,12 @@ class PersistentDict(object):
 
         from os.path import join
         if container_dir is None:
-            from tempfile import gettempdir
-            import getpass
-            container_dir = join(gettempdir(),
-                    "pytools-pdict-%s-uid%s-py%s" % (
+            import appdirs
+            container_dir = join(
+                    appdirs.user_cache_dir("pytools", "pytools"),
+                    "pdict-v2-%s-py%s" % (
                         identifier,
-                        getpass.getuser(),
-                        ".".join(str(i) for i in sys.version_info)))
+                        ".".join(str(i) for i in sys.version_info),))
 
         self.container_dir = container_dir
 
@@ -254,7 +253,7 @@ class PersistentDict(object):
         # {{{ ensure container directory exists
 
         try:
-            os.mkdir(self.container_dir)
+            os.makedirs(self.container_dir)
         except OSError, e:
             from errno import EEXIST
             if e.errno != EEXIST:
Index: pytools-2014.3/setup.py
===================================================================
--- pytools-2014.3.orig/setup.py
+++ pytools-2014.3/setup.py
@@ -43,7 +43,8 @@ setup(name="pytools",
           ],
 
       install_requires=[
-          "decorator>=3.2.0"
+          "decorator>=3.2.0",
+          "appdirs>=1.4.0",
           ],
 
       author="Andreas Kloeckner",