diff --git a/CHANGELOG.md b/CHANGELOG.md index e5f48e35fe..249c851a08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Tools helper code * The tools `create` command now sets up a `TEMPLATE` and a `dev` branch for syncing +* Fixed issue [379](https://github.com/nf-core/tools/issues/379) ### Syncing diff --git a/nf_core/utils.py b/nf_core/utils.py index 227bc903ed..a5ef17f7ab 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 @@ -70,20 +69,18 @@ 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 + - cachedir = os.path.join(tempfile.gettempdir(), 'nfcore_cache') + cachedir = os.path.join(os.getenv("HOME"), os.path.join('.nfcore', 'cache')) if not os.path.exists(cachedir): - os.mkdir(cachedir) + os.makedirs(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', ) - # Make world-writeable so that multi-user installations work - os.chmod(cachedir, 0o777) - os.chmod(os.path.join(cachedir, 'nfcore_cache.sqlite'), 0o777)