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

West commands tweaks #1749

Merged
merged 3 commits into from
Jan 17, 2020
Merged

Conversation

mbolivar
Copy link

@mbolivar mbolivar commented Jan 16, 2020

The first commit is necessary to keep this working with west's master branch.

The second one is just fiddling around.

The third one is needed so #1750 can be rebased on top and get a clean bill of health from pylint.

This is going away in west 0.7. We can just use f-strings instead.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
No functional changes. I just find these more readable than
str.format().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Jan 16, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@mbolivar mbolivar force-pushed the west-commands-tweaks branch 2 times, most recently from 30447ab to 602d659 Compare January 16, 2020 20:32
Changes that are required to get through CI due to additional linting
added since this file was originally merged.

I needed to use a couple of "disable" comments where the linter is
wrong.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
@mbolivar
Copy link
Author

CI is green; should be good to go

Copy link
Contributor

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

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

Looking good.

But moving code around like this has the risk of reviewers re-reviewing old code and then start commenting 😛

So a couple of questions.

Comment on lines +31 to +37
def check_west_version():
min_ver = '0.6.99'
if (packaging.version.parse(west_ver) <
packaging.version.parse(min_ver)):
log.die('this command currently requires a pre-release west '
f'(your west version is {west_ver}, '
f'but must be at least {min_ver}')
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought.
Should this be built into west itself, so that an extension command can simply state.
west_required_version and this way ensure that west is correct version.

I think this could be useful also for Zephyr, to ensure west is up to date, as well as anyone else doing extension commands.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this could be added to core zephyr, but honestly this is generic code that is not really west-specific. west already exports its __version__.

Copy link
Author

@mbolivar mbolivar Jan 17, 2020

Choose a reason for hiding this comment

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

This is built into west... as of west's master branch :). So we can't start to rely on it until that is released. That's what the manifest schema version feature is about.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @tejlmand meant the check_west_version() function. That is not built into west.

Copy link
Author

@mbolivar mbolivar Jan 17, 2020

Choose a reason for hiding this comment

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

It's true that the west version can move independently of the manifest schema version, but in practice users are only going to need a minimum version of west if either the manifest schema changes or the APIs change. In this case it's because of APIs. And I don't think we'll be updating APIs without also having a change to a manifest schema in practice, since it wouldn't be necessary, so I think practically this is the same thing.

But we can certainly add this to core west if we like.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.
Only reason for commenting here, was because this was where I spotted it, and wanted to hear opinions before rasing it as an enhancement issue.

Comment on lines +59 to +62
# TODO: does the fact that this is needed mean the west commit
# which names the manifest project 'manifest' unconditionally
# was wrong to do so?
if zp.name == 'manifest':
Copy link
Contributor

Choose a reason for hiding this comment

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

if all imported manifest project are named 'manifest', we could end up into some mess as all those are name manifest, although they are in different imported projects.
Is the reason for manifest name, that the toplevel project may not have self::path defined, and thus we cannot know the name (unless we simply use the folder name, if self::path is not set)
For imported projects, we could use the name specified in the manifest for the project being imported.

Should manifest be an attribute on a project, to indicate that it is an imported project and holds a manifest file itself ?
Each manifest project has a

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't follow here, we don't have a project named manifest in our manifest. Why is zp.name possibly set to manifest?

Copy link
Author

Choose a reason for hiding this comment

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

Well, as you know, I want to get rid of ManifestProject entirely; see zephyrproject-rtos/west#327.

This is yet more evidence that having the manifest itself as an object inside manifest.projects is a confusing mistake in my opinion :).

But for now, we do, and it's always named "manifest", which is a reserved name that no project can possibly have. The manifest.py parsing code checks that and rejects any attempt to name a project 'manifest'.

Either way I think this is more of a question about west than this particular PR, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's discuss this in west itself, since as @mbolivar describes, there are already plans to get rid of this project in memory as part of the project list.

Copy link
Contributor

Choose a reason for hiding this comment

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

@carlescufi completely agree.
Was not aware that the project name manifest was actually a side effect / would be fixed by zephyrproject-rtos/west#327.

@carlescufi carlescufi merged commit 6eb9862 into nrfconnect:master Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants