From 70b28a66210f16847ee685b7c7259cefe572732c Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Thu, 19 Sep 2019 14:41:27 +0200 Subject: [PATCH 1/6] Changes nf-core cache dir to user's home --- nf_core/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 227bc903ed..ffb1397f6d 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -75,8 +75,9 @@ def setup_requests_cachedir(): """ # Only import it if we need it import requests_cache + - cachedir = os.path.join(tempfile.gettempdir(), 'nfcore_cache') + cachedir = os.path.join(os.getenv("HOME"), '.nfcore_cache') if not os.path.exists(cachedir): os.mkdir(cachedir) requests_cache.install_cache( @@ -84,6 +85,3 @@ def setup_requests_cachedir(): expire_after=datetime.timedelta(hours=1), backend='sqlite', ) - # Make world-writeable so that multi-user installations work - os.chmod(cachedir, 0o777) - os.chmod(os.path.join(cachedir, 'nfcore_cache.sqlite'), 0o777) From bd281142e3fddf275b59f2bee608282e0160813f Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Thu, 19 Sep 2019 14:55:35 +0200 Subject: [PATCH 2/6] Updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 704bae2040..216057fff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Tools helper code * The tools `create` command now sets up a TEMPLATE branch for syncing +* Fixed issue [379](https://github.com/nf-core/tools/issues/379) ### Syncing From 097398a536d52c886f6d0931470ceaf983d0f3c3 Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Fri, 20 Sep 2019 11:43:01 +0200 Subject: [PATCH 3/6] Updates caching method docs --- nf_core/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index ffb1397f6d..37a9d19cb5 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -70,8 +70,8 @@ def fetch_wf_config(wf_path, wf=None): def setup_requests_cachedir(): """Sets up local caching for faster remote HTTP requests. - Caching directory will be generated by tempfile.gettempdir() under - a nfcore_cache subdir. + Caching directory will be set up in the user's home directory under + a .nfcore_cache subdir. """ # Only import it if we need it import requests_cache From f9fffc8da9f1c86757b4d2f8bb6264e5487b9c0f Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Fri, 20 Sep 2019 11:45:24 +0200 Subject: [PATCH 4/6] Removes unused import statement --- nf_core/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 37a9d19cb5..0b1eec5bc9 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -8,7 +8,6 @@ import logging import os import subprocess -import tempfile def fetch_wf_config(wf_path, wf=None): """Uses Nextflow to retrieve the the configuration variables From 1a95fdd0402fdb54df8965ca7175fe3b3adf10de Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Fri, 20 Sep 2019 14:50:16 +0200 Subject: [PATCH 5/6] Refactors cache path --- nf_core/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 0b1eec5bc9..6993e2f927 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -76,11 +76,11 @@ def setup_requests_cachedir(): import requests_cache - cachedir = os.path.join(os.getenv("HOME"), '.nfcore_cache') + cachedir = os.path.join(os.getenv("HOME"), os.path.join('.nfcore', 'cache')) if not os.path.exists(cachedir): - os.mkdir(cachedir) + os.mkdirs(cachedir) requests_cache.install_cache( - os.path.join(cachedir, 'nfcore_cache'), + os.path.join(cachedir, 'github_info'), expire_after=datetime.timedelta(hours=1), backend='sqlite', ) From cb39811496cad52e1eea6ba4380929531f0ad9c6 Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Fri, 20 Sep 2019 14:54:46 +0200 Subject: [PATCH 6/6] Refactors function call --- nf_core/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 6993e2f927..a5ef17f7ab 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -78,7 +78,7 @@ def setup_requests_cachedir(): cachedir = os.path.join(os.getenv("HOME"), os.path.join('.nfcore', 'cache')) if not os.path.exists(cachedir): - os.mkdirs(cachedir) + os.makedirs(cachedir) requests_cache.install_cache( os.path.join(cachedir, 'github_info'), expire_after=datetime.timedelta(hours=1),