Skip to content

Commit

Permalink
drop if instead
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Jun 10, 2024
1 parent 65328f4 commit 787feb1
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions planemo/commands/cmd_autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,26 @@ def cli(ctx, paths, **kwds): # noqa C901
with engine_context(ctx, **kwds) as galaxy_engine:
with galaxy_engine.ensure_runnables_served(modified_workflows) as config:
for workflow in modified_workflows:
if config.updated_repos.get(workflow.path) or kwds.get("engine") == "external_galaxy":
info("Auto-updating workflow %s" % workflow.path)
updated_workflow = autoupdate.autoupdate_wf(ctx, config, workflow)

if workflow.path.endswith(".ga"):
with open(workflow.path) as f:
original_workflow = json.load(f)
edited_workflow = autoupdate.fix_workflow_ga(original_workflow, updated_workflow)
with open(workflow.path, "w") as f:
json.dump(edited_workflow, f, indent=4)
else:
with open(workflow.path) as f:
original_workflow = yaml.load(f, Loader=yaml.SafeLoader)
edited_workflow = autoupdate.fix_workflow_gxformat2(original_workflow, updated_workflow)
with open(workflow.path, "w") as f:
yaml.dump(edited_workflow, f)
if original_workflow.get("release"):
info(
f"The workflow release number has been updated from "
f"{original_workflow.get('release')} to {edited_workflow.get('release')}."
)
info("Auto-updating workflow %s" % workflow.path)
updated_workflow = autoupdate.autoupdate_wf(ctx, config, workflow)

if workflow.path.endswith(".ga"):
with open(workflow.path) as f:
original_workflow = json.load(f)
edited_workflow = autoupdate.fix_workflow_ga(original_workflow, updated_workflow)
with open(workflow.path, "w") as f:
json.dump(edited_workflow, f, indent=4)
else:
with open(workflow.path) as f:
original_workflow = yaml.load(f, Loader=yaml.SafeLoader)
edited_workflow = autoupdate.fix_workflow_gxformat2(original_workflow, updated_workflow)
with open(workflow.path, "w") as f:
yaml.dump(edited_workflow, f)
if original_workflow.get("release"):
info(
f"The workflow release number has been updated from "
f"{original_workflow.get('release')} to {edited_workflow.get('release')}."
)

if kwds["test"]:
if not modified_files and not modified_workflows:
Expand Down

0 comments on commit 787feb1

Please sign in to comment.