|
1 | 1 |
|
2 | 2 | from copy import deepcopy
|
3 | 3 | from itertools import product
|
| 4 | +from sys import exit |
4 | 5 |
|
5 |
| -from pythonforandroid.logger import (info, info_notify, warning) |
| 6 | +from pythonforandroid.logger import (info, info_notify, warning, error) |
6 | 7 | from pythonforandroid.recipe import Recipe
|
7 | 8 | from pythonforandroid.bootstrap import Bootstrap
|
8 | 9 |
|
@@ -219,27 +220,41 @@ def new_get_recipe_order_and_bootstrap(ctx, names, bs=None):
|
219 | 220 | try:
|
220 | 221 | order = find_order(possible_order)
|
221 | 222 | except ValueError: # a circular dependency was found
|
222 |
| - info('Circular dependency found in graph {}'.format(possible_order)) |
| 223 | + info('Circular dependency found in graph {}, skipping it.'.format(possible_order)) |
223 | 224 | continue
|
| 225 | + except: |
| 226 | + warning('Failed to import recipe named {}; the recipe exists ' |
| 227 | + 'but appears broken.'.format(name)) |
| 228 | + warning('Exception was:') |
| 229 | + raise |
224 | 230 | orders.append(list(order))
|
225 | 231 |
|
226 | 232 | # prefer python2 and SDL2 if available
|
227 | 233 | orders = sorted(orders,
|
228 | 234 | key=lambda order: -('python2' in order) - ('sdl2' in order))
|
229 | 235 |
|
| 236 | + if not orders: |
| 237 | + error('Didn\'t find any valid dependency graphs.') |
| 238 | + error('This means that some of your requirements pull in conflicting dependencies.') |
| 239 | + error('Exiting.') |
| 240 | + exit(1) |
230 | 241 | # It would be better to check against possible orders other
|
231 | 242 | # than the first one, but in practice clashes will be rare,
|
232 | 243 | # and can be resolved by specifying more parameters
|
233 |
| - order = orders[0] |
234 |
| - |
235 |
| - print('pre-bs order is', order) |
| 244 | + chosen_order = orders[0] |
| 245 | + if len(orders) > 1: |
| 246 | + info('Found multiple valid dependency orders:') |
| 247 | + for order in orders: |
| 248 | + info(' {}'.format(order)) |
| 249 | + info('Using the first of these: {}'.format(chosen_order)) |
| 250 | + else: |
| 251 | + info('Found a single valid recipe set: {}'.format(chosen_order)) |
236 | 252 |
|
237 | 253 | if bs is None:
|
238 |
| - bs = Bootstrap.get_bootstrap_from_recipes(order, ctx) |
239 |
| - orders, bs = new_get_recipe_order_and_bootstrap(ctx, order, bs=bs) |
240 |
| - order = orders[0] |
241 |
| - |
242 |
| - return order, bs |
| 254 | + bs = Bootstrap.get_bootstrap_from_recipes(chosen_order, ctx) |
| 255 | + chosen_order, bs = new_get_recipe_order_and_bootstrap(ctx, chosen_order, bs=bs) |
| 256 | + |
| 257 | + return chosen_order, bs |
243 | 258 |
|
244 | 259 |
|
245 | 260 |
|
|
0 commit comments