本文整理汇总了Python中pythonforandroid.recipe.Recipe.list_recipes方法的典型用法代码示例。如果您正苦于以下问题:Python Recipe.list_recipes方法的具体用法?Python Recipe.list_recipes怎么用?Python Recipe.list_recipes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythonforandroid.recipe.Recipe
的用法示例。
在下文中一共展示了Recipe.list_recipes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recipes
# 需要导入模块: from pythonforandroid.recipe import Recipe [as 别名]
# 或者: from pythonforandroid.recipe.Recipe import list_recipes [as 别名]
def recipes(self, args):
parser = argparse.ArgumentParser(
description="List all the available recipes")
parser.add_argument(
"--compact", action="store_true", default=False,
help="Produce a compact list suitable for scripting")
args = parser.parse_args(args)
ctx = self.ctx
if args.compact:
print(" ".join(set(Recipe.list_recipes(ctx))))
else:
for name in sorted(Recipe.list_recipes(ctx)):
recipe = Recipe.get_recipe(name, ctx)
version = str(recipe.version)
print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
'{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
'{version:<8}{Style.RESET_ALL}'.format(
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
version=version))
print(' {Fore.GREEN}depends: {recipe.depends}'
'{Fore.RESET}'.format(recipe=recipe, Fore=Out_Fore))
if recipe.conflicts:
print(' {Fore.RED}conflicts: {recipe.conflicts}'
'{Fore.RESET}'
.format(recipe=recipe, Fore=Out_Fore))
if recipe.opt_depends:
print(' {Fore.YELLOW}optional depends: '
'{recipe.opt_depends}{Fore.RESET}'
.format(recipe=recipe, Fore=Out_Fore))
示例2: recipes
# 需要导入模块: from pythonforandroid.recipe import Recipe [as 别名]
# 或者: from pythonforandroid.recipe.Recipe import list_recipes [as 别名]
def recipes(self, args):
ctx = self.ctx
if args.compact:
print(" ".join(set(Recipe.list_recipes(ctx))))
else:
for name in sorted(Recipe.list_recipes(ctx)):
try:
recipe = Recipe.get_recipe(name, ctx)
except IOError:
warning('Recipe "{}" could not be loaded'.format(name))
except SyntaxError:
import traceback
traceback.print_exc()
warning(('Recipe "{}" could not be loaded due to a '
'syntax error').format(name))
version = str(recipe.version)
print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
'{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
'{version:<8}{Style.RESET_ALL}'.format(
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
version=version))
print(' {Fore.GREEN}depends: {recipe.depends}'
'{Fore.RESET}'.format(recipe=recipe, Fore=Out_Fore))
if recipe.conflicts:
print(' {Fore.RED}conflicts: {recipe.conflicts}'
'{Fore.RESET}'
.format(recipe=recipe, Fore=Out_Fore))
if recipe.opt_depends:
print(' {Fore.YELLOW}optional depends: '
'{recipe.opt_depends}{Fore.RESET}'
.format(recipe=recipe, Fore=Out_Fore))
示例3: test_list_recipes
# 需要导入模块: from pythonforandroid.recipe import Recipe [as 别名]
# 或者: from pythonforandroid.recipe.Recipe import list_recipes [as 别名]
def test_list_recipes(self):
"""
Trivial test verifying list_recipes returns a generator with some recipes.
"""
ctx = Context()
recipes = Recipe.list_recipes(ctx)
self.assertTrue(isinstance(recipes, types.GeneratorType))
recipes = list(recipes)
self.assertIn('python3', recipes)
示例4: recipes
# 需要导入模块: from pythonforandroid.recipe import Recipe [as 别名]
# 或者: from pythonforandroid.recipe.Recipe import list_recipes [as 别名]
def recipes(self, args):
ctx = self.ctx
if args.compact:
print(" ".join(set(Recipe.list_recipes(ctx))))
else:
for name in sorted(Recipe.list_recipes(ctx)):
recipe = Recipe.get_recipe(name, ctx)
version = str(recipe.version)
print('{Fore.BLUE}{Style.BRIGHT}{recipe.name:<12} '
'{Style.RESET_ALL}{Fore.LIGHTBLUE_EX}'
'{version:<8}{Style.RESET_ALL}'.format(
recipe=recipe, Fore=Out_Fore, Style=Out_Style,
version=version))
print(' {Fore.GREEN}depends: {recipe.depends}'
'{Fore.RESET}'.format(recipe=recipe, Fore=Out_Fore))
if recipe.conflicts:
print(' {Fore.RED}conflicts: {recipe.conflicts}'
'{Fore.RESET}'
.format(recipe=recipe, Fore=Out_Fore))
if recipe.opt_depends:
print(' {Fore.YELLOW}optional depends: '
'{recipe.opt_depends}{Fore.RESET}'
.format(recipe=recipe, Fore=Out_Fore))