#NEWLINE# @ classmethod #NEWLINE# def get_recipe( cls , name , ctx ) : #NEWLINE# #INDENT# 'Returns the Recipe with the given name, if it exists.' #NEWLINE# if ( not hasattr ( cls , 'recipes' ) ) : #NEWLINE# #INDENT# cls . recipes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( name in cls . recipes ) : #NEWLINE# #INDENT# return cls . recipes [ name ] #NEWLINE# #UNINDENT# recipe_file = None #NEWLINE# for recipes_dir in cls . recipe_dirs ( ctx ) : #NEWLINE# #INDENT# recipe_file = join ( recipes_dir , name , '__init__.py' ) #NEWLINE# if exists ( recipe_file ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# recipe_file = None #NEWLINE# #UNINDENT# if ( not recipe_file ) : #NEWLINE# #INDENT# raise IOError ( 'Recipe does not exist: {}' . format ( name ) ) #NEWLINE# #UNINDENT# mod = import_recipe ( 'pythonforandroid.recipes.{}' . format ( name ) , recipe_file ) #NEWLINE# if ( len ( logger . handlers ) > 1 ) : #NEWLINE# #INDENT# logger . removeHandler ( logger . handlers [ 1 ] ) #NEWLINE# #UNINDENT# recipe = cls . recipe #NEWLINE# recipe . recipe_dir = dirname ( recipe_file ) #NEWLINE# recipe . ctx = ctx #NEWLINE# cls . recipes [ name ] = recipe #NEWLINE# return recipe