From 808f646b8f917d594819da2878dc04bc8c06ff7c Mon Sep 17 00:00:00 2001 From: Ryan Pessa Date: Sat, 16 Apr 2016 23:13:58 -0500 Subject: [PATCH] select version from requirements --- toolchain.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/toolchain.py b/toolchain.py index 246b5d2..1b84fa0 100755 --- a/toolchain.py +++ b/toolchain.py @@ -783,11 +783,22 @@ class Recipe(object): def get_recipe(cls, name, ctx): if not hasattr(cls, "recipes"): cls.recipes = {} + + if '==' in name: + name, version = name.split('==') + else: + version = None + if name in cls.recipes: - return cls.recipes[name] - mod = importlib.import_module("recipes.{}".format(name)) - recipe = mod.recipe - recipe.recipe_dir = join(ctx.root_dir, "recipes", name) + recipe = cls.recipes[name] + else: + mod = importlib.import_module("recipes.{}".format(name)) + recipe = mod.recipe + recipe.recipe_dir = join(ctx.root_dir, "recipes", name) + + if version: + recipe.version = version + return recipe