Skip to content

Commit

Permalink
Merge pull request #140 from paulzierep/fix-symlink-without-location-…
Browse files Browse the repository at this point in the history
…error

hot-fix the symlink error
  • Loading branch information
bebatut authored Jun 26, 2024
2 parents 2f86519 + 10623a8 commit e313e11
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions bin/extract_galaxy_tools.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

import argparse
import base64
import json
import sys
import time
import traceback
import xml.etree.ElementTree as et
from functools import lru_cache
from pathlib import Path
Expand Down Expand Up @@ -98,22 +98,28 @@ def get_string_content(cf: ContentFile) -> str:
:param cf: GitHub ContentFile object
"""

return base64.b64decode(cf.content).decode("utf-8")


def get_tool_github_repositories(
g: Github, repository_list: Optional[str], run_test: bool, add_extra_repositories: bool = True
g: Github,
repository_list: Optional[str],
run_test: bool,
test_repository: str = "https://github.com/paulzierep/Galaxy-Tool-Metadata-Extractor-Test-Wrapper",
add_extra_repositories: bool = True,
) -> List[str]:
"""
Get list of tool GitHub repositories to parse
:param g: GitHub instance
:param repository_list: The selection to use from the repository (needed to split the process for CI jobs)
:param run_test: for testing only parse the repository
:test_repository: the link to the test repository to use for the test
"""

if run_test:
return ["https://github.com/paulzierep/Galaxy-Tool-Metadata-Extractor-Test-Wrapper"]
return [test_repository]

repo = g.get_user("galaxyproject").get_repo("planemo-monitor")
repo_list: List[str] = []
Expand Down Expand Up @@ -318,11 +324,11 @@ def get_tool_metadata(tool: ContentFile, repo: Repository) -> Optional[Dict[str,
# parse XML file and get meta data from there
for file in file_list:
if file.name.endswith("xml") and "macro" not in file.name:
file_content = get_string_content(file)
try:
file_content = get_string_content(file)
root = et.fromstring(file_content)
except Exception:
print(file_content, sys.stderr)
print(traceback.format_exc())
else:
# version
if metadata["Galaxy wrapper version"] is None:
Expand Down Expand Up @@ -513,6 +519,7 @@ def export_tools_to_tsv(
:param output_fp: path to output file
:param format_list_col: boolean indicating if list columns should be formatting
"""

df = pd.DataFrame(tools).sort_values("Galaxy wrapper id")
if format_list_col:
df["ToolShed categories"] = shared_functions.format_list_column(df["ToolShed categories"])
Expand Down Expand Up @@ -698,6 +705,7 @@ def reduce_ontology_terms(terms: List, ontology: Any) -> List:
f"Error while extracting tools from repo {r}: {e}",
file=sys.stderr,
)
print(traceback.format_exc())

#######################################################
# add additional information to the List[Dict] object
Expand Down

0 comments on commit e313e11

Please sign in to comment.