Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def cli(ctx, paths, **kwds):
"""Check a Tool Shed repository for common problems.
"""
def lint(realized_repository):
return shed_lint.lint_repository(ctx, realized_repository, **kwds)
kwds["fail_on_missing"] = False
exit_code = shed.for_each_repository(ctx, lint, paths, **kwds)
sys.exit(exit_code)
'errorContent': escape(diff_output_contents),
})
elif result == 1:
collected_data['results']['failures'] += 1
xunit_case.update({
'errorType': 'Different',
'errorMessage': 'Repository is different',
'errorContent': escape(diff_output_contents),
})
# Append our xunit test case
collected_data['tests'].append(xunit_case)
return result
exit_code = shed.for_each_repository(ctx, diff, paths, **kwds)
handle_report_xunit_kwd(kwds, collected_data)
sys.exit(exit_code)
def cli(ctx, paths, **kwds):
"""Download a tool repository as a tarball from the tool shed and extract
to the specified directory.
"""
shed_context = shed.get_shed_context(ctx, read_only=True, **kwds)
def download(realized_repository):
return shed.download_tarball(ctx, shed_context, realized_repository, **kwds)
exit_code = shed.for_each_repository(ctx, download, paths, **kwds)
sys.exit(exit_code)
metadata (to handle metadata changes in ``.shed.yml`` files).
\b
% planemo shed_upload --tar_only ~/
% tar -tzf shed_upload.tar.gz
test-data/blastdb.loc
...
tools/ncbi_blast_plus/tool_dependencies.xml
% tar -tzf shed_upload.tar.gz | wc -l
117
"""
def upload(realized_repository):
return shed.upload_repository(ctx, realized_repository, **kwds)
exit_code = shed.for_each_repository(ctx, upload, paths, **kwds)
sys.exit(exit_code)
def cli(ctx, path, **kwds):
"""Create a Galaxy tool tarball from a ``.shed.yml`` file.
"""
def build(realized_repository):
tarpath = shed.build_tarball(realized_repository.real_path)
outpath = realized_repository.real_path + ".tar.gz"
shutil.move(tarpath, outpath)
print("Created: %s" % (outpath))
return 0
exit_code = shed.for_each_repository(ctx, build, [path], **kwds)
sys.exit(exit_code)
exit = exit or 1
else:
collected_data['results']['failures'] += 1
repo_result.update({
'errorType': 'FailedUpdate',
'errorMessage': 'Failed to update repository',
})
if metadata_ok:
error("Failed to update repository contents for %s." % repository_destination_label)
else:
error("Failed to update repository contents and metadata for %s." % repository_destination_label)
exit = exit or 1
collected_data['tests'].append(repo_result)
return exit
exit_code = shed.for_each_repository(ctx, update, paths, **kwds)
handle_report_xunit_kwd(kwds, collected_data)
sys.exit(exit_code)
repo_id = realized_repository.find_repository_id(ctx, shed_context)
if repo_id is None:
if realized_repository.create(ctx, shed_context):
info("Repository created")
if not kwds["skip_upload"]:
return shed.upload_repository(
ctx, realized_repository, **kwds
)
else:
return 0
else:
return 2
else:
return 1
exit_code = shed.for_each_repository(ctx, create, paths, **kwds)
sys.exit(exit_code)