Skip to content

Fix crash when guessing Bootstrap (expand_dependencies) #1914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pythonforandroid/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,13 @@ def expand_dependencies(recipes, ctx):
if not isinstance(entry, (tuple, list)) or len(entry) == 1:
if isinstance(entry, (tuple, list)):
entry = entry[0]
recipe = Recipe.get_recipe(entry, ctx)
recipes_with_deps += recipe.depends
try:
recipe = Recipe.get_recipe(entry, ctx)
recipes_with_deps += recipe.depends
except ValueError:
# it's a pure python package without a recipe, so we
# don't know the dependencies...skipping for now
pass

# Split up lists by available alternatives:
recipe_lists = [[]]
Expand Down
12 changes: 12 additions & 0 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ def test_expand_dependencies(self):
expanded_result_2 = expand_dependencies([("pysdl2", "kivy")], self.ctx)
self.assertEqual([["pysdl2"], ["kivy"]], expanded_result_2)

def test_expand_dependencies_with_pure_python_package(self):
"""Check that `expanded_dependencies`, with a pure python package as
one of the dependencies, returns a list of dependencies
"""
expanded_result = expand_dependencies(
["python3", "kivy", "peewee"], self.ctx
)
self.assertEqual(len(expanded_result), 3)
self.assertIsInstance(expanded_result, list)
for i in expanded_result:
self.assertIsInstance(i, list)

def test_get_bootstraps_from_recipes(self):
"""A test which will initialize a bootstrap and will check if the
method :meth:`~pythonforandroid.bootstrap.Bootstrap.
Expand Down