Skip to content

Commit 4c168df

Browse files
committed
Fixed silent fail when broken recipes are imported
1 parent e3f3759 commit 4c168df

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

pythonforandroid/toolchain.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,11 +1830,15 @@ def get_recipe(cls, name, ctx):
18301830
cls.recipes = {}
18311831
if name in cls.recipes:
18321832
return cls.recipes[name]
1833+
recipe_dir = join(ctx.root_dir, 'recipes', name)
1834+
if not exists(recipe_dir): # AND: This will need modifying
1835+
# for user-supplied recipes
1836+
raise IOError('Recipe folder does not exist')
18331837
mod = importlib.import_module("pythonforandroid.recipes.{}".format(name))
18341838
if len(logger.handlers) > 1:
18351839
logger.removeHandler(logger.handlers[1])
18361840
recipe = mod.recipe
1837-
recipe.recipe_dir = join(ctx.root_dir, "recipes", name)
1841+
recipe.recipe_dir = recipe_dir
18381842
recipe.ctx = ctx
18391843
return recipe
18401844

@@ -2299,10 +2303,17 @@ def get_recipe_order_and_bootstrap(ctx, names, bs=None):
22992303
continue
23002304
try:
23012305
recipe = Recipe.get_recipe(name, ctx)
2302-
except ImportError:
2306+
except IOError:
23032307
info('No recipe named {}; will attempt to install with pip'.format(name))
23042308
python_modules.append(name)
23052309
continue
2310+
except (KeyboardInterrupt, SystemExit):
2311+
raise
2312+
except:
2313+
warning('Failed to import recipe named {}; the recipe exists '
2314+
'but appears broken.'.format(name))
2315+
warning('Exception was:')
2316+
raise
23062317
graph.add(name, name)
23072318
info('Loaded recipe {} (depends on {}{})'.format(
23082319
name, recipe.depends,

0 commit comments

Comments
 (0)