diff env/lib/python3.9/site-packages/galaxy/tool_util/deps/brew_util.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.9/site-packages/galaxy/tool_util/deps/brew_util.py	Mon Mar 22 18:12:50 2021 +0000
@@ -0,0 +1,39 @@
+""" brew_exts defines generic extensions to Homebrew this file
+builds on those abstraction and provides Galaxy specific functionality
+not useful to the brew external commands.
+"""
+from ..deps import brew_exts
+
+DEFAULT_TAP = "homebrew/science"
+
+
+class HomebrewRecipe:
+
+    def __init__(self, recipe, version, tap):
+        self.recipe = recipe
+        self.version = version
+        self.tap = tap
+
+
+def requirements_to_recipes(requirements):
+    return filter(None, map(requirement_to_recipe, requirements))
+
+
+def requirement_to_recipe(requirement):
+    if requirement.type != "package":
+        return None
+    # TOOD: Allow requirements to annotate optionalbrew specific
+    # adaptions.
+    recipe_name = requirement.name
+    recipe_version = requirement.version
+    return HomebrewRecipe(recipe_name, recipe_version, tap=DEFAULT_TAP)
+
+
+def requirements_to_recipe_contexts(requirements, brew_context):
+    def to_recipe_context(homebrew_recipe):
+        return brew_exts.RecipeContext(
+            homebrew_recipe.recipe,
+            homebrew_recipe.version,
+            brew_context
+        )
+    return map(to_recipe_context, requirements_to_recipes(requirements))