Skip to content
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

Parse environment markers when auto installing. #889

Merged
merged 1 commit into from
May 3, 2019

Conversation

bridadan
Copy link
Contributor

The following change in Mbed OS added an environment marker to
the python requirements file:
https://github.com/ARMmbed/mbed-os/pull/10096/files#diff-b4ef698db8ca845e5845c4618278f29aR24
Mbed CLI did not know how to parse this, so a warning was always
generated. This change now parses the "platform_system" marker, and
adds a mechanism to add more if needed in the future.

This fixes #888.

@teetak01 Jimmy is unavailable for the month April, can you review please?

The following change in Mbed OS added an environment marker to
the python requirements file:
https://github.com/ARMmbed/mbed-os/pull/10096/files#diff-b4ef698db8ca845e5845c4618278f29aR24
Mbed CLI did not know how to parse this, so a warning was always
generated. This change now parses the "platform_system" marker, and
adds a mechanism to add more if needed in the future.
@bridadan bridadan requested a review from cmonr May 2, 2019 18:35
Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

I like it. Just a non-blocking question.

missing.append(pkg)
line_parts = line.split(";")

for line_part in line_parts[1:]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the 1: needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A python requirements file looks like this:

pyusb>=1.0.0,<2.0.0
hidapi>=0.7.99,<0.8.0;platform_system!="Linux"

line_parts for the first line would look like: ["pyusb>=1.0.0,<2.0.0"].
For the second one, it would look like ["hidapi>=0.7.99,<0.8.0", "platform_system!=\"Linux\""].
So the [1:] only selects what comes after the first ;, if there is one, which is the environment markers that we're trying to parse.

@ConradBraam
Copy link

code caters for the cases I can know of, welcome improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mbed CLI tries to auto-install even when everything is up to date (hidapi on linux)
4 participants