diff --git a/HISTORY.rst b/HISTORY.rst index a5d069ca..c1efa30c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,8 @@ Release History ------------------ * Improved detection of build changes +* Avoided ``LibInstallDependencyError`` when more then 1 library is found + (`issue #229 `_) 2.1.0 (2015-06-03) ------------------ diff --git a/platformio/__init__.py b/platformio/__init__.py index 4fbcd92a..e3c0b661 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 1, "1.dev2") +VERSION = (2, 1, "1.dev3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 7bf31383..b2fed51b 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -142,8 +142,23 @@ def lib_install_dependency(ctx, data): query.append('+"%s"' % data[key]) result = get_api_result("/lib/search", dict(query=" ".join(query))) - assert result['total'] == 1 - ctx.invoke(lib_install, libid=[result['items'][0]['id']]) + assert result['total'] > 0 + + if result['total'] == 1 or not app.get_setting("enable_prompts"): + ctx.invoke(lib_install, libid=[result['items'][0]['id']]) + else: + click.secho( + "Conflict: More then one dependent libraries have been found " + "by request %s:" % json.dumps(data), fg="red") + + echo_liblist_header() + for item in result['items']: + echo_liblist_item(item) + + deplib_id = click.prompt( + "Please choose one dependent library ID", + type=click.Choice([str(i['id']) for i in result['items']])) + ctx.invoke(lib_install, libid=[int(deplib_id)]) @cli.command("uninstall", short_help="Uninstall libraries")