Skip to content

Parse environment markers when auto installing.#889

Merged
mark-edgeworth merged 1 commit intoARMmbed:masterfrom
bridadan:fix_autoinstall_linux
May 3, 2019
Merged

Parse environment markers when auto installing.#889
mark-edgeworth merged 1 commit intoARMmbed:masterfrom
bridadan:fix_autoinstall_linux

Conversation

@bridadan
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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