Skip to content

Commit

Permalink
Merge pull request #68 from bmerry/master
Browse files Browse the repository at this point in the history
Use appdirs module to get appropriate cache directory.
  • Loading branch information
inducer committed Nov 14, 2014
2 parents 4608e16 + fae4161 commit aaf35ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pyopencl/cache.py
Expand Up @@ -337,16 +337,15 @@ def _create_built_program_from_source_cached(ctx, src, options, devices, cache_d
option_idx += 1

if cache_dir is None:
from tempfile import gettempdir
import getpass
cache_dir = join(gettempdir(),
"pyopencl-compiler-cache-v2-uid%s-py%s" % (
getpass.getuser(), ".".join(str(i) for i in sys.version_info)))
import appdirs
cache_dir = join(appdirs.user_cache_dir("pyopencl", "pyopencl"),
"pyopencl-compiler-cache-v2-py%s" % (
".".join(str(i) for i in sys.version_info),))

# {{{ ensure cache directory exists

try:
os.mkdir(cache_dir)
os.makedirs(cache_dir)
except OSError, e:
from errno import EEXIST
if e.errno != EEXIST:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -208,6 +208,7 @@ def main():
"pytools>=2014.2",
"pytest>=2",
"decorator>=3.2.0",
"appdirs>=1.4.0",
# "Mako>=0.3.6",
],

Expand Down

0 comments on commit aaf35ed

Please sign in to comment.