Skip to content

Commit

Permalink
Add checks for python interface functions.
Browse files Browse the repository at this point in the history
This catches some edge cases when no scripts
  • Loading branch information
henrykironde committed Oct 26, 2017
1 parent 4e87207 commit 8acfed8
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions retriever/lib/download.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from __future__ import absolute_import
from __future__ import print_function

import os

from retriever.engines import choose_engine
from retriever.lib.defaults import DATA_DIR, SCRIPT_WRITE_PATH
from retriever.lib.scripts import SCRIPT_LIST
from retriever.lib.tools import name_matches

script_list = SCRIPT_LIST()
from retriever.lib.repository import check_for_updates


def download(dataset, path='./', quiet=False, subdir=False, debug=False):
@@ -18,7 +20,10 @@ def download(dataset, path='./', quiet=False, subdir=False, debug=False):
'quiet': quiet
}
engine = choose_engine(args)

script_list = SCRIPT_LIST()
if not script_list or not os.listdir(SCRIPT_WRITE_PATH):
check_for_updates()
script_list = SCRIPT_LIST(force_compile=False)
scripts = name_matches(script_list, args['dataset'])
if scripts:
for script in scripts:
6 changes: 3 additions & 3 deletions retriever/lib/install.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
import os

from retriever.engines import choose_engine
from retriever.lib.defaults import DATA_DIR
from retriever.lib.defaults import DATA_DIR, SCRIPT_WRITE_PATH
from retriever.lib.scripts import SCRIPT_LIST
from retriever.lib.tools import name_matches
from retriever.lib.repository import check_for_updates
@@ -16,9 +16,9 @@ def _install(args, use_cache, debug):
engine.use_cache = use_cache

script_list = SCRIPT_LIST()
if not script_list:
if not script_list or not os.listdir(SCRIPT_WRITE_PATH):
check_for_updates()
script_list = SCRIPT_LIST()
script_list = SCRIPT_LIST(force_compile=False)
data_sets_scripts = name_matches(script_list, args['dataset'])
if data_sets_scripts:
for data_sets_script in data_sets_scripts:

0 comments on commit 8acfed8

Please sign in to comment.