From 849b938b2ee9759675ad3e86c5628fde32158c50 Mon Sep 17 00:00:00 2001 From: abearab Date: Mon, 8 Apr 2024 08:18:21 -0700 Subject: [PATCH] update setup to include data_dir argument --- CanDI/setup/__init__.py | 1 - CanDI/setup/install.py | 5 +++-- CanDI/setup/manager.py | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CanDI/setup/__init__.py b/CanDI/setup/__init__.py index e6d4b38..e69de29 100644 --- a/CanDI/setup/__init__.py +++ b/CanDI/setup/__init__.py @@ -1 +0,0 @@ -from . import install \ No newline at end of file diff --git a/CanDI/setup/install.py b/CanDI/setup/install.py index 6115fcd..0042e94 100644 --- a/CanDI/setup/install.py +++ b/CanDI/setup/install.py @@ -4,17 +4,18 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument("--source", help="Specify the download source", default="dataverse") + parser.add_argument("--data_dir", help="Specify the data directory", default=None) args = parser.parse_args() if args.source == 'dataverse': print("Downloading data from Dataverse") - m = Manager(download_source=args.source) + m = Manager(download_source=args.source, data_dir=args.data_dir) m.download_reformatted_data() m.write_config(m.cfig_path, m.parser) elif args.source == 'depmap': print("Downloading data from DepMap") - m = Manager(download_source=args.source) + m = Manager(download_source=args.source, data_dir=args.data_dir) m.get_depmap_info() m.write_config(m.cfig_path, m.parser) m.download_defaults() diff --git a/CanDI/setup/manager.py b/CanDI/setup/manager.py index a1e956b..51eb913 100644 --- a/CanDI/setup/manager.py +++ b/CanDI/setup/manager.py @@ -15,9 +15,13 @@ class Manager(object): and the config file. It is used to setup of the config file upon installation. All data downloading is done by Manager """ - def __init__(self, download_source=None): + def __init__(self, download_source=None, data_dir=None): - manager_path = os.path.dirname(os.path.realpath(__file__)) + if data_dir: + manager_path = data_dir + else: + manager_path = os.path.dirname(os.path.realpath(__file__)) + cfig_path = manager_path + "/data/config.ini" parser = configparser.ConfigParser() parser.read(cfig_path.replace(".ini", ".draft.ini"))