Change the url, revision, and clone_depth properties to plain old
attributes, changing url from None to the empty string. This will be
used to make it possible to type annotate Project in a subsequent
commit.
This seems like even more evidence that ManifestProject is not a
Project in a subtyping sense, should not have been treated like one,
and should be removed (#327).
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We should be passing the actual version string to
ManifestVersionError, not the parsed version object.
Do the same in the f-string just for consistency.
Caught by mypy.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
We were forced to allow multiple values into west_commands during the
west 0.7 dev cycle as a result of the way manifest imports work, but
the way it was implemented needs a bit of fixing up.
Make sure that Project and ManifestProject can take either a list or
a string of west_commands and that the resulting object attribute is
always a list, for consistency. Fix the docstrings to make clear
what's going on. Adjust users in commands.py -- this is cleaner now.
Callers have had to cope with the possibility that this could be a
list since v0.7 was released, so this shouldn't break any up-to-date
extensions.
This patch also enables a schema relaxation where we could support
multiple extension spec YAML files in a single manifest written by
hand. But let's defer that work until someone actually asks for it.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The SchemaError type's error message should be accessed via the msg()
property, not the underlying private instance variable.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is partially being done to clean up and reorganize, but the
specific goal in mind is making it easier to add type information
to more functions and methods.
- make Manifest.projects a property, and ensure the underlying
_projects attribute is always a list
- move code around so that definitions of types are visible more
often when variables of those types are used. For instance, move
the Project definition above Manifest, because many variables
in the Manifest methods have type Project, List[Project], etc.
This is in my opinion a readability improvement, and also will allow
using the token Project as a type name from the Manifest class
definition later. Similar comments apply to named tuple definitions,
etc.
No functionality changes expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This reverts commit 5843eef713. We
figured out another way to accomplish the goal that this was done for,
so there's no reason to expose these details to the user now.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Added documentation to main() as it is now officially supported to
directly call main from west.app.main module.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
These changes introduce initial support for type hints. Support for mypy
static analysis on GitHub workflows has also been enabled.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Some new flake8 errors are enabled by default now; fix them up:
./src/west/manifest.py:1633:47: E741 ambiguous variable name 'l'
./src/west/app/project.py:802:21: F541 f-string is missing placeholders
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The output is kind of cluttered when many projects are available.
Let's silence output for projects with no diff when not in verbose mode.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
A few process changes from doing a point release, mainly that we'll
cut an alpha release instead of an RC. That's being done because
uploading an alpha is something a maintainer can just do, without
having to go through the usual "bump version.py" review process.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If the user imports a manifest, and specifies its west-commands, like
this:
- name: zephyr
west-commands: scripts/west-commands.yml
where zephyr/west.yml also specifies a west-commands, then they get
warnings when the manifest is parsed, like this:
WARNING: ignoring project zephyr extension command "completion"; command "completion" is already defined as extension command
WARNING: ignoring project zephyr extension command "boards"; command "boards" is already defined as extension command
WARNING: ignoring project zephyr extension command "build"; command "build" is already defined as extension command
WARNING: ignoring project zephyr extension command "sign"; command "sign" is already defined as extension command
WARNING: ignoring project zephyr extension command "flash"; command "flash" is already defined as extension command
WARNING: ignoring project zephyr extension command "debug"; command "debug" is already defined as extension command
WARNING: ignoring project zephyr extension command "debugserver"; command "debugserver" is already defined as extension command
WARNING: ignoring project zephyr extension command "attach"; command "attach" is already defined as extension command
Filter duplicates when merging west commands during manifest parsing
to avoid this outcome.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Make the 'west update' output more helpful:
- If --keep-descendants is given, also run 'git status' to highlight a
dirty tree, etc. Also make the west output prefixed by 'west update';
it's clear what project is being worked on due to the earlier banner.
- if --rebase is given, do the same change to just use 'west update'
as an output prefix.
- if neither is given, remove --quiet and the small_banner() call. This
also shows information about a dirty tree.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fixes: #378
When Zephyr is also the manifest repository then west fails to identify
ZEPHYR_BASE correctly as the project name is manifest, with path zephyr.
Therefore, before checking projects with path `zephyr` we first check if
the manifest repository has path == zephyr.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This is where we'll put notes for west maintainers.
For now, it includes information on cutting a release.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fixes: #374
This commit ensures that west topdir always prints in posix style and
thus fixes an issue in windows where CMake fails to parse the path when
'\' is used as separator.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
With all the statistics gathering, this is getting pretty long and
hard to read. Let's factor it out into some new methods.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Track all operations which invoke a subprocess.
Track the total time in the update() call, and print out time spent
doing work not explicitly tracked.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fix copy/paste issue in which the 'runs-on' was always ubuntu-latest so
we didn't actually do anything with the matrix.os to run on mac or
windows.
Also cleanup some minor formatting and report the sys.platform so we can
verify in the future we are on the correct platform.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The test_import_project*() cases in test_project.py are failing on
windows for reasons that are irrelevant and ultimately down to path
comparisons not being canonicalized for that platform.
Rather than fix tests I don't really think are broken, check if the
expected URL is an actual directory and fall back on PurePath
comparisons instead.
Keep the behavior the same for macOS and Linux.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
If the manifest URL is a windows-style path,
e.g. C:\Users\marti\my-manifest, then the current code produces a
manifest.path configuration option set to '\Users\marti\my-manifest'
instead of the expected 'my-manifest'.
Fix it by using PurePath so we get PureWindowsPath on windows, instead
of using the low-level posixpath. Note that PurePath is PurePosixPath
on POSIX platforms, so the behavior is the same on those.
Fix the import order while we are here, moving stdlib imports to their
proper section.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Git is returning empty content for dir\file.yml on Windows.
Using PurePosixPath fixes it there, and can't possibly break anything
on Unix.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Hopefully the last one.
Note that this "fix" is purely cosmetic, for use when reading debugger
output.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The LocalPath object is not iterable on at least some versions of
pytest, which means that some checks done in subprocess ("\t" in
some_instance) are throwing exceptions.
Sprinkle some str() calls around to make this go away.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The shlex.split() call done in Project.git() when you pass a string
isn't doing the right thing for Windows-style abspaths. Let's use
lists instead.
This converts all the cases caught by the test suite. Hopefully there
aren't any more.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This prints performance statistics. Zephyr wants it for figuring out
slowdowns observed in CI.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
At this point, the manifest schema is frozen, so we can also update
west.manifest.SCHEMA_VERSION to 0.7, as this version of west parses
anything that 0.7 will be able to parse.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
"Close the parentheses" when done resolving a project import, and add
project revision information when importing from a project.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This kind of verbose detail about the parsed manifest is not always
useful to others.
E.g. downstream in the nRF Connect SDK, this is cluttering up the
output of a west extension that compares mainline zephyr's manifest
repository revisions with NCS's. This seems like an annoyance to me,
so this logging shouldn't be global.
We do, however, need it for debugging when resolving the manifest
and running 'west -vv update'.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
I keep running into edge cases trying to get proper import loop
detection going, so just catch the RecursionError it causes and
convert it to ManifestImportFailed.
Testing this takes a while, so we only will do that from CI for now.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
I want to add more values to the private context we pass around as we
resolve the manifest, but it's annoying to do so one parameter at a
time, since it requires updating a lot of functions.
Let's make a container object for this state and pass it around instead.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Track which projects we've already updated via update_importer() and
don't do it twice if it's already done.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>