Commit graph

6 commits

Author SHA1 Message Date
Simon Glass
3d094ce28a u_boot_pylib: Add a function to run a single command
Add a helper to avoid needing to use a list within a list for this
simple case.

Update existing users of runpipe() to use this where possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04 13:31:49 -06:00
Simon Glass
f8456c91aa u_boot_pylib: Fix pylint warnings in command
This file has a lot of warnings. Before adding any more features, fix
those which are straightforward to resolve.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04 13:31:49 -06:00
Simon Glass
54ead4be04 u_boot_pylib: Add an exception-class for errors
Throwing an Exception is not very friendly since it is the top-level
class of all exceptions. Declare a new class instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04 13:31:49 -06:00
Simon Glass
d6900a778a u_boot_pylib: Correct case for test_result
This should be in capitals and defined at the start of the file. Update
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04 13:31:49 -06:00
Simon Glass
ae94c3d4ee u_boot_pylib: Ensure subprocess is closed down
It isn't clear why we need to have two different paths for closing down
the pipe. Unify them and use the Python to avoid this warning:

  subprocess.py:1127: ResourceWarning: subprocess 83531 is still running

Note that this code appears to originally have come from [1] and was
committed into the ChromeOS chromiumos/platform/crosutils repo in the
bin/cros_image_to_target.py file. The addition of the extra code path
came later, so that is chosen for the fixes tag.

[1] https://codereview.chromium.org/3391008

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a10fd93cbc patman: Make command methods return a CommandResult
2023-11-02 22:38:01 -04:00
Simon Glass
4583c00236 patman: Move library functions into a library directory
The patman directory has a number of modules which are used by other tools
in U-Boot. This makes it hard to package the tools using pypi since the
common files must be copied along with the tool that uses them.

To address this, move these files into a new u_boot_pylib library. This
can be packaged separately and listed as a dependency of each tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08 11:40:49 -08:00
Renamed from tools/patman/command.py (Browse further)