Skip to content

Commit

Permalink
Merge pull request #381 from sven1103/master
Browse files Browse the repository at this point in the history
Changes nf-core cache dir to user's home
  • Loading branch information
sven1103 authored Sep 20, 2019
2 parents 86e0bde + cb39811 commit 5dcca6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 6 additions & 9 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 5dcca6a

Please sign in to comment.