Merge pull request #186 from kived/recipe-version
allow version to be selected from requirements
This commit is contained in:
commit
34a4b85b47
1 changed files with 15 additions and 4 deletions
13
toolchain.py
13
toolchain.py
|
@ -783,11 +783,22 @@ class Recipe(object):
|
||||||
def get_recipe(cls, name, ctx):
|
def get_recipe(cls, name, ctx):
|
||||||
if not hasattr(cls, "recipes"):
|
if not hasattr(cls, "recipes"):
|
||||||
cls.recipes = {}
|
cls.recipes = {}
|
||||||
|
|
||||||
|
if '==' in name:
|
||||||
|
name, version = name.split('==')
|
||||||
|
else:
|
||||||
|
version = None
|
||||||
|
|
||||||
if name in cls.recipes:
|
if name in cls.recipes:
|
||||||
return cls.recipes[name]
|
recipe = cls.recipes[name]
|
||||||
|
else:
|
||||||
mod = importlib.import_module("recipes.{}".format(name))
|
mod = importlib.import_module("recipes.{}".format(name))
|
||||||
recipe = mod.recipe
|
recipe = mod.recipe
|
||||||
recipe.recipe_dir = join(ctx.root_dir, "recipes", name)
|
recipe.recipe_dir = join(ctx.root_dir, "recipes", name)
|
||||||
|
|
||||||
|
if version:
|
||||||
|
recipe.version = version
|
||||||
|
|
||||||
return recipe
|
return recipe
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue