Skip to content

Commit

Permalink
update setup to include data_dir argument
Browse files Browse the repository at this point in the history
  • Loading branch information
abearab committed Apr 8, 2024
1 parent fadc820 commit 849b938
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion CanDI/setup/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from . import install
5 changes: 3 additions & 2 deletions CanDI/setup/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions CanDI/setup/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 849b938

Please sign in to comment.