Mercurial > repos > iuc > data_manager_cat
comparison data_manager/data_manager_cat.py @ 1:74af283d8ebd draft
"planemo upload commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author | iuc |
---|---|
date | Sun, 22 Nov 2020 12:47:10 +0000 |
parents | cffd8e2382cf |
children |
comparison
equal
deleted
inserted
replaced
0:cffd8e2382cf | 1:74af283d8ebd |
---|---|
87 os.makedirs(args.install_path) | 87 os.makedirs(args.install_path) |
88 if args.db_url: | 88 if args.db_url: |
89 url_download(args.db_url, args.install_path) | 89 url_download(args.db_url, args.install_path) |
90 else: | 90 else: |
91 cat_prepare(args.install_path) | 91 cat_prepare(args.install_path) |
92 for root, dirs, files in os.walk(args.install_path): | 92 for root, dirs, _ in os.walk(args.install_path): |
93 for dname in dirs: | 93 for dname in dirs: |
94 if dname.endswith('CAT_database'): | 94 if dname.endswith('CAT_database'): |
95 cat_db = dname | 95 cat_db = dname |
96 elif dname.endswith('taxonomy'): | 96 elif dname.endswith('taxonomy'): |
97 tax_db = dname | 97 tax_db = dname |
107 data_table_entry = dict(value=cat_dir, name=cat_dir, | 107 data_table_entry = dict(value=cat_dir, name=cat_dir, |
108 database_folder=os.path.join(cat_dir, cat_db), | 108 database_folder=os.path.join(cat_dir, cat_db), |
109 taxonomy_folder=os.path.join(cat_dir, tax_db)) | 109 taxonomy_folder=os.path.join(cat_dir, tax_db)) |
110 dm_dict['data_tables'][data_table].append(data_table_entry) | 110 dm_dict['data_tables'][data_table].append(data_table_entry) |
111 # save info to json file | 111 # save info to json file |
112 open(args.config_file, 'w').write(json.dumps(dm_dict)) | 112 with open(args.config_file, 'w') as fh: |
113 json.dump(dm_dict, fh, sort_keys=True) | |
113 | 114 |
114 | 115 |
115 if __name__ == "__main__": | 116 if __name__ == "__main__": |
116 main() | 117 main() |