# HG changeset patch # User iuc # Date 1594973975 14400 # Node ID 93253aebaf2e386d6db765446f9d198aff4026f3 # Parent 5833ef61c1f870f6301b031e9bd9b3498e8ab77f "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_plant_tribes_scaffolds_downloader commit 6085b7d47fcb47ad1587ac2542abdef782f61fe4" diff -r 5833ef61c1f8 -r 93253aebaf2e data_manager/data_manager_plant_tribes_scaffolds_download.py --- a/data_manager/data_manager_plant_tribes_scaffolds_download.py Fri Aug 17 07:04:08 2018 -0400 +++ b/data_manager/data_manager_plant_tribes_scaffolds_download.py Fri Jul 17 04:19:35 2020 -0400 @@ -7,9 +7,8 @@ import shutil import sys import tarfile -import urllib2 import zipfile - +from urllib.request import Request, urlopen DEFAULT_DATA_TABLE_NAMES = ["plant_tribes_scaffolds"] @@ -52,22 +51,20 @@ src = None dst = None try: - req = urllib2.Request(url) - src = urllib2.urlopen(req) - dst = open(file_path, 'wb') - while True: - chunk = src.read(2**10) - if chunk: - dst.write(chunk) - else: - break + req = Request(url) + src = urlopen(req) + with open(file_path, 'wb') as dst: + while True: + chunk = src.read(2**10) + if chunk: + dst.write(chunk) + else: + break except Exception as e: - print >>sys.stderr, str(e) + sys.exit(str(e)) finally: if src: src.close() - if dst: - dst.close() return file_path @@ -117,9 +114,8 @@ args = parser.parse_args() -# Some magic happens with tools of type "manage_data" in that the output -# file contains some JSON data that allows us to define the target directory. -params = json.loads(open(args.out_file).read()) +with open(args.out_file) as fh: + params = json.loads(fh.read()) target_directory = params['output_data'][0]['extra_files_path'] make_directory(target_directory) @@ -131,6 +127,5 @@ # Get the scaffolds data. data_manager_dict = download(target_directory, args.web_url, args.config_web_url, description) # Write the JSON output dataset. -fh = open(args.out_file, 'wb') -fh.write(json.dumps(data_manager_dict)) -fh.close() +with open(args.out_file, 'w') as fh: + fh.write(json.dumps(data_manager_dict, sort_keys=True)) diff -r 5833ef61c1f8 -r 93253aebaf2e data_manager/data_manager_plant_tribes_scaffolds_download.xml --- a/data_manager/data_manager_plant_tribes_scaffolds_download.xml Fri Aug 17 07:04:08 2018 -0400 +++ b/data_manager/data_manager_plant_tribes_scaffolds_download.xml Fri Jul 17 04:19:35 2020 -0400 @@ -1,18 +1,15 @@ - + - - - - - - + + python + + @@ -24,6 +21,13 @@ + + + + + + + .. class:: infomark diff -r 5833ef61c1f8 -r 93253aebaf2e data_manager_conf.xml --- a/data_manager_conf.xml Fri Aug 17 07:04:08 2018 -0400 +++ b/data_manager_conf.xml Fri Jul 17 04:19:35 2020 -0400 @@ -3,17 +3,17 @@ - + - + > ${path} plant_tribes/scaffolds/${value} ${GALAXY_DATA_MANAGER_DATA_PATH}/plant_tribes/scaffolds/${value} abspath - + diff -r 5833ef61c1f8 -r 93253aebaf2e test-data/plant_tribes_scaffolds.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/plant_tribes_scaffolds.json Fri Jul 17 04:19:35 2020 -0400 @@ -0,0 +1,1 @@ +{"data_tables": {"plant_tribes_scaffolds": [{"description": "12 plant genomes (Monocots, version 1.0)", "name": "12Gv1.0", "path": diff -r 5833ef61c1f8 -r 93253aebaf2e test-data/plant_tribes_scaffolds.loc diff -r 5833ef61c1f8 -r 93253aebaf2e tool_data_table_conf.xml.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Fri Jul 17 04:19:35 2020 -0400 @@ -0,0 +1,7 @@ + + + + value, name, path, description + +
+