Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conda hash to mulled-hash utility #18938

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lib/galaxy/tool_util/deps/mulled/mulled_hash.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python
"""Produce a mulled hash for specified conda targets.

Galaxy does not use the "v1" hash format for uncontainerized conda dependencies. For the mulled hash for conda
dependencies, use `--hash conda`

Examples

Produce a mulled hash with:
Expand All @@ -9,23 +12,31 @@
"""

from ._cli import arg_parser
from ..conda_util import hash_conda_packages
from .mulled_build import target_str_to_targets
from .util import (
v1_image_name,
v2_image_name,
)


IMAGE_FUNCS = {
"conda": lambda x: f"mulled-v1-{hash_conda_packages(x)}",
"v1": v1_image_name,
"v2": v2_image_name,
}


def main(argv=None):
"""Main entry-point for the CLI tool."""
parser = arg_parser(argv, globals())
parser.add_argument(
"targets", metavar="TARGETS", default=None, help="Comma-separated packages for calculating the mulled hash."
)
parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2")
parser.add_argument("--hash", dest="hash", choices=["conda", "v1", "v2"], default="v2")
natefoo marked this conversation as resolved.
Show resolved Hide resolved
args = parser.parse_args()
targets = target_str_to_targets(args.targets)
image_name = v2_image_name if args.hash == "v2" else v1_image_name
image_name = IMAGE_FUNCS[args.hash]
print(image_name(targets))


Expand Down
Loading