Skip to content

Commit

Permalink
Just get the whole directory archive for now
Browse files Browse the repository at this point in the history
We could get fancier and get individual files one by one ... but not
sure there's any point in making it so complicated ?
  • Loading branch information
mvdbeek committed Oct 30, 2023
1 parent b61c354 commit b8c9968
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/galaxy/tool_util/cwl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,11 @@ def dir_listing(dir_path):
"basename": basename,
"listing": listing,
}
_handle_pseudo_location(properties, pseudo_location=pseudo_location, download_url=output_metadata["download_url"] + "?to_ext=directory")
_handle_pseudo_location(
properties,
pseudo_location=pseudo_location,
download_url=output_metadata["download_url"] + "?to_ext=directory",
)

extra_files = get_extra_files(output_metadata)
for extra_file in extra_files:
Expand Down
18 changes: 17 additions & 1 deletion lib/galaxy_test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ def conformance_tests_gen(directory, filename="conformance_tests.yaml"):
yield conformance_test


def to_local_location(listing, location):
for item in listing:
if "basename" in item:
item["location"] = f"file://{os.path.join(location[len('file://'):], item['basename'])}"
if "listing" in item:
to_local_location(item["listing"], location=item["location"])


def output_to_disk(output, download_folder):
if isinstance(output, dict):
if "secondaryFiles" in output:
Expand All @@ -274,9 +282,17 @@ def output_to_disk(output, download_folder):
]
if "basename" in output:
download_path = os.path.join(download_folder, output["basename"])
download_to_file(output["location"], download_path)
if output["class"] == "Directory":
zip_path = f"{download_path}.zip"
download_to_file(output["location"], zip_path)
CompressedFile(zip_path).extract(download_folder)
os.remove(zip_path)
else:
download_to_file(output["location"], download_path)
output["path"] = download_path
output["location"] = f"file://{download_path}"
if "listing" in output:
to_local_location(output["listing"], output["location"])
return output
else:
new_output = {}
Expand Down

0 comments on commit b8c9968

Please sign in to comment.