Skip to content

Commit 04e0484

Browse files
committed
using XDG standard env variable for caching
1 parent 218f8b5 commit 04e0484

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cwltool/pathmapper.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,21 @@ def trim_listing(obj):
147147
# Download http Files
148148
def downloadHttpFile(httpurl):
149149
cache_session = None
150-
if "HOME" in os.environ:
150+
if "XDG_CACHE_HOME" in os.environ:
151151
cache_session = CacheControl(
152152
requests.Session(),
153153
cache=FileCache(
154-
os.path.join(os.environ["HOME"], ".cache", "cwltool")))
155-
elif "TMP" in os.environ:
154+
os.path.join(os.environ["XDG_CACHE_HOME"], "cwltool")))
155+
elif "HOME" in os.environ:
156156
cache_session = CacheControl(
157157
requests.Session(),
158-
cache=FileCache(os.path.join(os.environ["TMP"], ".cache", "cwltool")))
158+
cache=FileCache(
159+
os.path.join(os.environ["HOME"], ".cache", "cwltool")))
159160
else:
160161
cache_session = CacheControl(
161162
requests.Session(),
162-
cache=FileCache("/tmp", ".cache", "cwltool"))
163+
cache=FileCache(
164+
os.path.join(os.path.expanduser('~'), ".cache", "cwltool")))
163165

164166
r = cache_session.get(httpurl, stream=True)
165167
with NamedTemporaryFile(mode='wb', delete=False) as f:

0 commit comments

Comments
 (0)