Commit Graph

923 Commits

Author SHA1 Message Date
Pieter De Gendt e05251a797 project: Fix assert-false (B011)
Derived from flake8-bugbear, see
https://docs.astral.sh/ruff/rules/assert-false/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-05 21:34:09 +01:00
Pieter De Gendt 8127067c63 project: Extend ruff check with pycodestyle
Enable pycodestyle rules when running ruff check.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-05 21:34:09 +01:00
Pieter De Gendt 815fefb397 project: Extend ruff with isort checks
Check for isort issues when running ruff check.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-05 08:18:41 +01:00
Pieter De Gendt d2d099031c tests: Format and sort imports
Apply isort on files in tests/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-05 08:18:41 +01:00
Pieter De Gendt 467ee3b9bb src: Format and sort imports
Apply isort on files in src/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-05 08:18:41 +01:00
Pieter De Gendt 53419128f0 project: Extend ruff with pyupgrade checks
Check for deprecated usages in the project when running ruff check.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 26d92b75c6 project: Fix f-string (UP032)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/f-string/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 7e28267445 project: Fix unicode-kind-prefix (UP025)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/unicode-kind-prefix/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 66f25ec5dd project: Fix deprecated-import for Iterable (UP035)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/deprecated-import/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt d1b3f698ca project: Fix quoted-annotation (UP037)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/quoted-annotation/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 8718171953 project: Fix super-call-with-parameters (UP008)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/super-call-with-parameters/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 747a842a3c project: Fix non-pep585-annotation for tuple (UP006)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/non-pep585-annotation/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt e73c1f8615 project: Fix non-pep585-annotation for set (UP006)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/non-pep585-annotation/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt ab07a16fe9 project: Fix non-pep585-annotation for dict (UP006)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/non-pep585-annotation/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 3afd3b4631 project: Fix non-pep585-annotation for list (UP006)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/non-pep585-annotation/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 1d3f6bc2b5 project: Fix redundant-open-modes (UP015)
Derived from pyupgrade, see
https://docs.astral.sh/ruff/rules/redundant-open-modes/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 16:30:55 +01:00
Pieter De Gendt 3ca3a00959 project: Add ruff check to tox
Run ruff check as part of tox.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 08:14:33 +01:00
Pieter De Gendt 306b0a2bb8 manifest: Fix type comparisons
Fix errors for: E721 Use `is` and `is not` for type comparisons

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-04 08:14:33 +01:00
Pieter De Gendt 531e330cdf ci: tox: Turn pytest warnings into errors
Don't allow warnings during CI testing.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-30 09:15:52 +01:00
Pieter De Gendt 0536d7a3c4 configuration: Update arguments type for delete_config
The deprecated delete_config function supports passing a list
of ConfigFile enumerations. Update argument typing accordingly.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-30 09:15:52 +01:00
Pieter De Gendt 292c43c5b8 tests: Wrap or remove deprecated functions in test_config.py
Make deprecated calls explicit during testing or remove them if
unnecessary.
Change the update_config and delete_config helper methods to use a
Configuration class instead of the global deprecated config functions.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-30 09:15:52 +01:00
Pieter De Gendt 38655154af tests: Remove deprecated calls to read_config
These calls are deprecated and unneeded, simply remove them.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-30 09:15:52 +01:00
Marc Herbert e1958cedbe project: "fail fast" west init when directories cannot be renamed
In October 2024, a problem reported in #558 showed that some Windows
systems can be configured to allow directory and file creations but not
renames. Test this _before_ git cloning to "fail fast" and remove git
from the very confusing picture.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-10-21 22:57:52 +02:00
Marc Herbert 7370037c05 project: add west init --rename-delay-hack
This will be useful as both a diagnostic tool and as a workaround; see
October 2024 comments in west issue #558 for examples and details.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-10-21 22:57:52 +02:00
Marc Herbert e03e34dded commands: make die() print a stack trace when -vvv or more
Print a stack trace when debugging with -vvv or more. This is MUCH
faster than `git grep error_message` and it's even more useful when the
same error message is used in multiple places! Example: die_already() in
project.py

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-10-21 13:40:05 +02:00
Pieter De Gendt d36e887b5e tests: Add test cases for invalid west projects manifests
Add tests for cases where projects are inside the .west directory.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-21 13:39:14 +02:00
Pieter De Gendt 9f4dcf55c0 manifest: Do not allow projects inside the west directory
It's not allowed to have projects inside the .west directory,
add a check when parsing the manifest.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-21 13:39:14 +02:00
Pieter De Gendt 4163c96b28 app: Re-use constant WEST_DIR
Use the literal constant WEST_DIR instead of using the same string
value scattered around the project.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-21 13:39:14 +02:00
Pieter De Gendt c3aadf5301 .github: Update supported python versions
Python 3.8 is end-of-life, removed.
Python 3.13 is released, added.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-15 08:32:53 +02:00
Pieter De Gendt 85fd5979f2 manifest: Fix absolute path checking on windows for Python 3.13
Python 3.13 changed the behavior for os.path.isabs
https://docs.python.org/3/library/os.path.html#os.path.isabs

Prevent absolute paths that start with a '/'.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-15 08:32:53 +02:00
Pieter De Gendt 42c0a5d3d5 .github: Specify the download artifact for the distribution
Omitting the artifact name changes the behavior, it will download all
artifacts and create subdirectories for each.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-10 14:45:57 -07:00
Pieter De Gendt 979ef4e90a .github: Add comments to release workflow
Add more details on parts of the steps.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-10 14:45:57 -07:00
Pieter De Gendt c6d96c8364 version: 1.3.99
Update pyproject version to 1.3.99

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-10 11:32:32 +02:00
Marc Herbert 0199418012 project.py: fix west diff --manifest to use `manifest-rev`
Fixes new `west diff --manifest` option added by commit
0d5ee4eb08 ("app: project: Allow to diff against manifest revision")

Do not pass `project.revision` to `git diff` because `project.revision`
is unresolved user input and does not always resolve to a commit. For
instance, `project.revision` can be the name of a remote branch like
`v3.7-branch` that does not exist locally; then `git diff` fails. Or
even worse: there could be a local branch of the same name which points
to a totally different commit.

This bug was found when discussing issue #747, see 7th comment there for
a longer description of what `manifest-rev` is and how it works.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-10-09 12:34:45 -07:00
Muhammad Usman 1007557b92 Add test cases for west init -o= option 2024-10-08 07:43:50 -07:00
Muhammad Usman c80b291f18 Add option to specify git clone options like --depth for Zephyr repo clone via init 2024-10-08 07:43:50 -07:00
Pieter De Gendt 09ca0ce50d MAINTAINER.rst: Update Pypi releases
Update section on creating Pypi releases.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-03 15:20:31 -07:00
Pieter De Gendt 04b7bcb6d3 .github: Add release workflow
Upload a pypi package when a Github release is published.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-03 15:20:31 -07:00
Pieter De Gendt 38aae907fd .github: Add workflow for creating a pypi package
Add a package workflow with the latest python version to test creating a
pypi release.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-03 15:20:31 -07:00
Pieter De Gendt 4d1d8ad4d2 .github: Add testing for 3.11 and latest (currently 3.12)
Verify build for all major.minor versions from 3.8 till latest.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-03 15:20:31 -07:00
Martí Bolívar e432aff137 Add docker compose based testing
Our release process documentation recommends getting passing tox
results on as many popular linux distributions as time allows. Doing
this by hand is cumbersome, redundant, and error prone.

Add a directory with a helper script that automates the entire process
using docker compose and document its use in MAINTAINERS.rst.

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-25 07:18:42 -07:00
Martí Bolívar 113ff95ec5 tox.ini: generate HTML coverage output
This makes it trivial to inspect, line by line, what got covered.
That is useful when evaluating coverage for a new feature.

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
2024-09-25 07:18:42 -07:00
Pieter De Gendt 775dce9cc6 tests: Add manifest test for submodules
Add a testcase to parse a manifest and validate the as_dict output.
Add an invalid manifest file for missing required submodule properties.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-24 10:55:24 -07:00
Pieter De Gendt 0cebb60b70 tests: Add tests for manifest --freeze and submodules
Add a minimal testing to validate submodule output for manifest --freeze

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-24 10:55:24 -07:00
Pieter De Gendt 0da3de16eb manifest: Add submodule representation in as_dict
Submodules were missing when calling --freeze or --resolve

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-24 10:55:24 -07:00
Pieter De Gendt 08d0329131 README.rst: Update installing from source section
This section was outdated as we have moved to pyproject.toml.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-20 09:42:17 -07:00
Marc Herbert 49f0a101df app: tell the user to use `-vv` when debugging "manifest --validate"
It seems natural to recommend "debug" flags when telling the user to
"debug".

More specifically, this makes a big difference in situations like the
one reported in #671

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-09-16 07:06:32 -07:00
Ayush Singh c399c01257 project: Switch to pyproject
Starting with PEP 621, `pyproject.toml` is the standard way of
specifying project metadata.

Also switch to using the version from `pyproject.toml` instead of having
a west.version python module. Adjust documentation for the same.

Update MAINTAINERS.rst to use build for dist building.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2024-09-12 14:31:41 -07:00
Pieter De Gendt d4ad25641b tests: Add alias testing
Add simple test cases to verify alias' functionality.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-06 07:12:34 -07:00
Pieter De Gendt 9383d8216e app: support alias commands
Replace west commands with alias set in configuration files

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-06 07:12:34 -07:00