# HG changeset patch # User rhpvorderman # Date 1624970168 0 # Node ID b17f2fb4a5cb6cf9cbc989d08a88ac613756289d # Parent 4e2dd090d3ba436b655b4a5d7cf8aef6157c0a25 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 6c115a41a535feff1e805d3d10f3a39940e5d738" diff -r 4e2dd090d3ba -r b17f2fb4a5cb data_manager/data_manager_fetch_mothur_reference_data.xml --- a/data_manager/data_manager_fetch_mothur_reference_data.xml Mon Jun 28 13:02:27 2021 +0000 +++ b/data_manager/data_manager_fetch_mothur_reference_data.xml Tue Jun 29 12:36:08 2021 +0000 @@ -1,5 +1,5 @@ - + Fetch and install reference data for Mothur python diff -r 4e2dd090d3ba -r b17f2fb4a5cb data_manager/fetch_mothur_reference_data.py --- a/data_manager/fetch_mothur_reference_data.py Mon Jun 28 13:02:27 2021 +0000 +++ b/data_manager/fetch_mothur_reference_data.py Tue Jun 29 12:36:08 2021 +0000 @@ -11,7 +11,7 @@ import tempfile import urllib.request import zipfile -from typing import Generator, List, Iterable, Union, Optional, Dict +from typing import Dict, Generator, Iterable, List, Optional, Union # When extracting files from archives, skip names that # start with the following strings @@ -226,7 +226,7 @@ os.makedirs(target, exist_ok=True) else: # Extract file - print("Extracting {target}") + print(f"Extracting {target}") os.makedirs(os.path.dirname(target), exist_ok=True) with open(target, 'wb') as fh: with z.open(name) as zh: @@ -333,10 +333,14 @@ target = os.path.join(target_dir, ref_data_file) print(f"Moving {unpacked_file} to {target}") shutil.move(unpacked_file, target) - print(f"Removing {unpacked_file}") - os.remove(unpacked_file) data_tables['data_tables'][f"mothur_{type_}"].append( dict(name=entry_name, value=ref_data_file)) + print(f"Removing downloaded file: {filen}") + # check if file was not moved and therefore already deleted. + if os.path.exists(filen): + # Removing file early here minimizes temporary storage + # needed on the server. + os.remove(filen) print(f"Removing {wd}") shutil.rmtree(wd)