add tracker module, moularize tracking system
This commit is contained in:
parent
44ab402c6c
commit
3963b07c5f
6 changed files with 40 additions and 3 deletions
22
corrlib/tracker.py
Normal file
22
corrlib/tracker.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import os
|
||||
from configparser import ConfigParser
|
||||
from .trackers import datalad as dl
|
||||
|
||||
|
||||
def get_tracker(path):
|
||||
config_path = os.path.join(path, '.corrlib')
|
||||
config = ConfigParser()
|
||||
if os.path.exists(config_path):
|
||||
config.read(config_path)
|
||||
tracker = config.get('core', 'tracker', fallback='datalad')
|
||||
return tracker
|
||||
|
||||
|
||||
def get_file(path, file):
|
||||
tracker = get_tracker(path)
|
||||
if tracker == 'datalad':
|
||||
dl.get_file(path, file)
|
||||
else:
|
||||
raise ValueError(f"Tracker {tracker} is not supported.")
|
||||
return
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue