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

Avoid "LibInstallDependencyError" when more then 1 library is found #229

Closed
ivankravets opened this Issue Jun 6, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@ivankravets
Member

ivankravets commented Jun 6, 2015

Need to ask user via prompt which dependent lib should be installed.

@ivankravets ivankravets added the bug label Jun 6, 2015

@ivankravets ivankravets self-assigned this Jun 6, 2015

@ivankravets ivankravets added this to the 2.1.1 milestone Jun 6, 2015

@pelikhan

This comment has been minimized.

pelikhan commented Jun 6, 2015

No prompts!

Sent from Outlookhttp://taps.io/outlookmobile

On Sat, Jun 6, 2015 at 5:19 AM -0700, "Ivan Kravets" <notifications@github.commailto:notifications@github.com> wrote:

Need to ask user via prompt which dependent lib should be installed.

Reply to this email directly or view it on GitHubhttps://github.com//issues/229.

@ivankravets

This comment has been minimized.

Member

ivankravets commented Jun 6, 2015

@pelikhan Maybe, this is the most annoying feature in PlatformIO for you 😄 These prompts...

Nevertheless, please look into code:

    result = get_api_result("/lib/search", dict(query=" ".join(query)))
    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)])

If you can see, the prompts wont be used if 1 dependent library was found. If more then 1(this is conflict), then I have to ask user which dependent library (a list with dependent candidates will be shown) need to install.

Nevertheless, since PlatformIO 2.0 you can use -f/--force option before each command which automatically disable all prompts. For example, to install library with CONFLICTED dependencies and avoid prompts use:

platformio --force lib install %ID%

In this situation, PlatformIO will install the first library from the search result which is matched by dependent request.

@pelikhan

This comment has been minimized.

pelikhan commented Jun 6, 2015

In doubt, you should fail if --force is used.

Sent from Outlookhttp://taps.io/outlookmobile

On Sat, Jun 6, 2015 at 7:56 AM -0700, "Ivan Kravets" <notifications@github.commailto:notifications@github.com> wrote:

@pelikhanhttps://github.com/pelikhan Maybe, this is the most annoying feature in PlatformIO for you [😄] These prompts...

Nevertheless, please look into codehttps://github.com/platformio/platformio/commit/3b7ad2d3338c5a1cb5aa82198829be499ef4c512#diff-86ad8f7e8aafa191f30dab69b84f4736R147:

result = get_api_result("/lib/search", dict(query=" ".join(query)))
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)])

If you can see, the prompts wont be used if 1 dependent library was found. If more then 1(this is conflict), then I have to ask user which dependent library (a list with dependent candidates will be shown) need to install.

Nevertheless, since PlatformIO 2.0 you can use -f/--force option before each command which automatically disable all prompts. For example, to install library with CONFLICTED dependencies and avoid prompts use:

platformio --force lib install %ID%

In this situation, PlatformIO will install the first library from the search result which is matched by dependent request.

Reply to this email directly or view it on GitHubhttps://github.com//issues/229#issuecomment-109593087.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment