Skip to content

Commit

Permalink
Merge pull request #59 from bmerry/fix-54
Browse files Browse the repository at this point in the history
Use appdirs package to create cache in XDG-correct location
  • Loading branch information
inducer committed Nov 7, 2014
2 parents 9a86c76 + dbbb6fe commit 7edecc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pycuda/compiler.py
Expand Up @@ -208,13 +208,13 @@ def compile(source, nvcc="nvcc", options=None, keep=False,

if cache_dir is None:
from os.path import join
from tempfile import gettempdir
cache_dir = join(gettempdir(),
"pycuda-compiler-cache-v1-%s" % _get_per_user_string())
import appdirs
cache_dir = os.path.join(appdirs.user_cache_dir("pycuda", "pycuda"),
"compiler-cache-v1")

from os import mkdir
from os import makedirs
try:
mkdir(cache_dir)
makedirs(cache_dir)
except OSError, e:
from errno import EEXIST
if e.errno != EEXIST:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -179,7 +179,8 @@ def main():
install_requires=[
"pytools>=2011.2",
"pytest>=2",
"decorator>=3.2.0"
"decorator>=3.2.0",
"appdirs>=1.4.0"
],

ext_package="pycuda",
Expand Down

0 comments on commit 7edecc1

Please sign in to comment.