Skip to content

tools: Support uploading tools to PyPi for use with pip

Simon Glass u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest24 patches 24 repliesIn review
  2. v115 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Add a patch to hide the test options unless test code is available
- Add new patch to avoid importing test_checkpatch before it is needed
- Add new patch to use importlib to find the help
- Add patch to fix use of a type as a variable
- Add patch to split out the main code into a function
- Drop test files
- Fix removable of the /tmp dir
- Quite a few updates to make things work with the new names
- Rename the package to patch-manager
- Update the cover letter

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/24binman: Avoid unwanted output in testFitFirmwareLoadables()tools/binman/ftest.py+5 -41 reply
2/24Revert "patman: test_util: Print test stdout/stderr within test summaries"tools/concurrencytest/concurrencytest.py tools/patman/test_util.py+4 -1121 reply
3/24Remove concurrencytesttools/concurrencytest/.gitignore tools/concurrencytest/README.md tools/concurrencytest/__init__.py +2 more+2 -2211 reply
4/24patman: Move library functions into a library directoryscripts/event_dump.py test/run tools/binman/bintool.py +84 more+182 -1511 reply
5/24script: Add a script to build a PyPi packagescripts/make_pip.sh+117 -01 reply
6/24patman: Add support for building a u_boot_tools PyPi packageMakefile tools/u_boot_pylib/LICENSE tools/u_boot_pylib/README.rst +1 more+393 -11 reply
7/24patman: Avoid importing test_checkpatch before it is neededtools/patman/__main__.py+1 -11 reply
8/24patman: Add support for building a patman PyPi packageMakefile tools/patman/pyproject.toml+30 -01 reply
9/24buildman: Move the main code into a functiontools/buildman/main.py+16 -111 reply
10/24buildman: Hide the test options unless test code is availabletools/buildman/cmdline.py+10 -41 reply
11/24buildman: Fix use of a type as a variabletools/buildman/control.py+2 -21 reply
12/24buildman: Use importlib to find the helptools/buildman/control.py+3 -31 reply
13/24buildman: Add support for building a buildman PyPi packageMakefile tools/buildman/pyproject.toml+30 -01 reply
14/24dtoc: Hide the test options unless test code is availabletools/dtoc/main.py+13 -61 reply
15/24dtoc: Move the main code into a functiontools/dtoc/main.py+52 -481 reply
16/24dtoc: Use pathlib to find the test directorytools/dtoc/test_dtoc.py+4 -21 reply
17/24dtoc: Add support for building a dtoc PyPi packageMakefile tools/dtoc/README.rst tools/dtoc/pyproject.toml+42 -01 reply
18/24binman: Move the main code into a functiontools/binman/main.py+8 -41 reply
19/24binman: Hide the 'test' command unless test code is availabletools/binman/cmdline.py+21 -131 reply
20/24binman: Use importlib to find the helptools/binman/control.py+3 -31 reply
21/24binman: Add support for building a binmanu PyPi packageMakefile tools/binman/pyproject.toml+30 -01 reply
22/24test: Add concurrencytest to the requirementstest/py/requirements.txt+1 -01 reply
23/24doc: Add notes on how to install patman and binmantools/binman/binman.rst tools/patman/patman.rst+25 -01 reply
24/24CI: Add a check for building tools for PyPi.azure-pipelines.yml .gitlab-ci.yml+16 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/24] tools: Support uploading tools to PyPi for use with pip

Some of the tools in U-Boot are useful beyond just U-Boot. For example, patman can be used to work with Linux and other projects which use mailing lists (and patchwork) for patch submissions. Binman can be used to package firmware for any project, even though it is heavily slanted towards U-Boot so far.

While patman has a setup script which is easy to use, binman is a little more complicated, since it has dependencies, in particular pylibfdt

It would be better if we could put all the tools on PyPi.

This series adds a script for uploading tools. It makes it easier to update PyPi from time to time, when new features appear.

U-Boot uses tools/patman as a common library of Python functions. For this to work with PyPi it is easier to split these into a separate library, used by patman as well. This series creates a new 'u_boot_pylib' package for this purpose.

Unfortunately, the U-Boot version of concurrencytest has some local patches. To avoid dependency issues it seems better to revert these and rely on the upstream package[1], although note that it is not actually installed.

[1] Which unfortunately may be dead but perhaps we could request a new maintainer?

Changes in v2:
- Add a patch to hide the test options unless test code is available
- Add new patch to avoid importing test_checkpatch before it is needed
- Add new patch to use importlib to find the help
- Add patch to fix use of a type as a variable
- Add patch to split out the main code into a function
- Drop test files
- Fix removable of the /tmp dir
- Quite a few updates to make things work with the new names
- Rename the package to patch-manager
- Update the cover letter

Simon Glass (24):
binman: Avoid unwanted output in testFitFirmwareLoadables() Revert "patman: test_util: Print test stdout/stderr within test
summaries"
Remove concurrencytest
patman: Move library functions into a library directory
script: Add a script to build a PyPi package
patman: Add support for building a u_boot_tools PyPi package
patman: Avoid importing test_checkpatch before it is needed
patman: Add support for building a patman PyPi package
buildman: Move the main code into a function
buildman: Hide the test options unless test code is available
buildman: Fix use of a type as a variable
buildman: Use importlib to find the help
buildman: Add support for building a buildman PyPi package
dtoc: Hide the test options unless test code is available
dtoc: Move the main code into a function
dtoc: Use pathlib to find the test directory
dtoc: Add support for building a dtoc PyPi package
binman: Move the main code into a function
binman: Hide the 'test' command unless test code is available
binman: Use importlib to find the help
binman: Add support for building a binmanu PyPi package
test: Add concurrencytest to the requirements
doc: Add notes on how to install patman and binman
CI: Add a check for building tools for PyPi

 .azure-pipelines.yml                          |  10 +
 .gitlab-ci.yml                                |   6 +
 Makefile                                      |  22 +-
 scripts/event_dump.py                         |   2 +-
 scripts/make_pip.sh                           | 117 ++++++
 test/py/requirements.txt                      |   1 +
 test/run                                      |   1 +
 tools/binman/binman.rst                       |  13 +
 tools/binman/bintool.py                       |   8 +-
 tools/binman/bintool_test.py                  |   8 +-
 tools/binman/btool/lz4.py                     |   2 +-
 tools/binman/btool/lzma_alone.py              |   2 +-
 tools/binman/cbfs_util.py                     |   4 +-
 tools/binman/cbfs_util_test.py                |   4 +-
 tools/binman/cmdline.py                       |  34 +-
 tools/binman/control.py                       |  12 +-
 tools/binman/elf.py                           |   6 +-
 tools/binman/elf_test.py                      |   8 +-
 tools/binman/entry.py                         |   6 +-
 tools/binman/entry_test.py                    |   2 +-
 tools/binman/etype/_testing.py                |   2 +-
 tools/binman/etype/atf_fip.py                 |   2 +-
 tools/binman/etype/blob.py                    |   4 +-
 tools/binman/etype/blob_ext.py                |   4 +-
 tools/binman/etype/blob_ext_list.py           |   4 +-
 tools/binman/etype/fdtmap.py                  |   4 +-
 tools/binman/etype/files.py                   |   2 +-
 tools/binman/etype/fill.py                    |   2 +-
 tools/binman/etype/fit.py                     |   2 +-
 tools/binman/etype/fmap.py                    |   6 +-
 tools/binman/etype/gbb.py                     |   4 +-
 tools/binman/etype/intel_ifwi.py              |   2 +-
 tools/binman/etype/mkimage.py                 |   2 +-
 tools/binman/etype/null.py                    |   2 +-
 tools/binman/etype/pre_load.py                |   2 +-
 tools/binman/etype/section.py                 |   6 +-
 tools/binman/etype/text.py                    |   2 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py   |   2 +-
 tools/binman/etype/u_boot_elf.py              |   2 +-
 tools/binman/etype/u_boot_env.py              |   2 +-
 tools/binman/etype/u_boot_spl_bss_pad.py      |   2 +-
 tools/binman/etype/u_boot_spl_expanded.py     |   2 +-
 tools/binman/etype/u_boot_tpl_bss_pad.py      |   2 +-
 tools/binman/etype/u_boot_tpl_expanded.py     |   2 +-
 .../binman/etype/u_boot_tpl_with_ucode_ptr.py |   4 +-
 tools/binman/etype/u_boot_ucode.py            |   2 +-
 tools/binman/etype/u_boot_vpl_bss_pad.py      |   2 +-
 tools/binman/etype/u_boot_vpl_expanded.py     |   2 +-
 tools/binman/etype/u_boot_with_ucode_ptr.py   |   4 +-
 tools/binman/etype/vblock.py                  |   2 +-
 tools/binman/fdt_test.py                      |   2 +-
 tools/binman/fip_util.py                      |   4 +-
 tools/binman/fip_util_test.py                 |   4 +-
 tools/binman/fmap_util.py                     |   2 +-
 tools/binman/ftest.py                         |  17 +-
 tools/binman/image.py                         |   4 +-
 tools/binman/image_test.py                    |   2 +-
 tools/binman/main.py                          |  19 +-
 tools/binman/pyproject.toml                   |  29 ++
 tools/binman/state.py                         |   4 +-
 tools/buildman/builder.py                     |   6 +-
 tools/buildman/builderthread.py               |   2 +-
 tools/buildman/cfgutil.py                     |   2 +-
 tools/buildman/cmdline.py                     |  14 +-
 tools/buildman/control.py                     |  18 +-
 tools/buildman/func_test.py                   |   8 +-
 tools/buildman/main.py                        |  31 +-
 tools/buildman/pyproject.toml                 |  29 ++
 tools/buildman/test.py                        |   8 +-
 tools/buildman/toolchain.py                   |   6 +-
 tools/concurrencytest/.gitignore              |   1 -
 tools/concurrencytest/README.md               |  74 ----
 tools/concurrencytest/__init__.py             |   0
 tools/concurrencytest/concurrencytest.py      | 221 ------------
 tools/dtoc/README.rst                         |  15 +
 tools/dtoc/fdt.py                             |   2 +-
 tools/dtoc/fdt_util.py                        |   4 +-
 tools/dtoc/main.py                            | 110 +++---
 tools/dtoc/pyproject.toml                     |  26 ++
 tools/dtoc/test_dtoc.py                       |  10 +-
 tools/dtoc/test_fdt.py                        |   7 +-
 tools/dtoc/test_src_scan.py                   |   4 +-
 tools/patman/__init__.py                      |   7 +-
 tools/patman/__main__.py                      |  10 +-
 tools/patman/checkpatch.py                    |   4 +-
 tools/patman/control.py                       |   2 +-
 tools/patman/func_test.py                     |   6 +-
 tools/patman/get_maintainer.py                |   2 +-
 tools/patman/gitutil.py                       |   4 +-
 tools/patman/patchstream.py                   |   2 +-
 tools/patman/patman.rst                       |  12 +
 tools/patman/pyproject.toml                   |  29 ++
 tools/patman/series.py                        |   4 +-
 tools/patman/status.py                        |   4 +-
 tools/patman/test_settings.py                 |   2 +-
 tools/rmboard.py                              |   2 +-
 tools/u_boot_pylib/LICENSE                    | 339 ++++++++++++++++++
 tools/u_boot_pylib/README.rst                 |  15 +
 tools/u_boot_pylib/__init__.py                |   4 +
 tools/u_boot_pylib/__main__.py                |  23 ++
 tools/{patman => u_boot_pylib}/command.py     |   2 +-
 .../cros_subprocess.py                        |   0
 tools/u_boot_pylib/pyproject.toml             |  22 ++
 tools/{patman => u_boot_pylib}/terminal.py    |   0
 tools/{patman => u_boot_pylib}/test_util.py   |  39 +-
 tools/{patman => u_boot_pylib}/tools.py       |   4 +-
 tools/{patman => u_boot_pylib}/tout.py        |   2 +-
 tools/u_boot_pylib/u_boot_pylib               |   1 +
 108 files changed, 1000 insertions(+), 576 deletions(-)
 create mode 100755 scripts/make_pip.sh
 create mode 100644 tools/binman/pyproject.toml
 create mode 100644 tools/buildman/pyproject.toml
 delete mode 100644 tools/concurrencytest/.gitignore
 delete mode 100644 tools/concurrencytest/README.md
 delete mode 100644 tools/concurrencytest/__init__.py
 delete mode 100644 tools/concurrencytest/concurrencytest.py
 create mode 100644 tools/dtoc/README.rst
 create mode 100644 tools/dtoc/pyproject.toml
 create mode 100644 tools/patman/pyproject.toml
 create mode 100644 tools/u_boot_pylib/LICENSE
 create mode 100644 tools/u_boot_pylib/README.rst
 create mode 100644 tools/u_boot_pylib/__init__.py
 create mode 100755 tools/u_boot_pylib/__main__.py
 rename tools/{patman => u_boot_pylib}/command.py (99%)
 rename tools/{patman => u_boot_pylib}/cros_subprocess.py (100%)
 create mode 100644 tools/u_boot_pylib/pyproject.toml
 rename tools/{patman => u_boot_pylib}/terminal.py (100%)
 rename tools/{patman => u_boot_pylib}/test_util.py (85%)
 rename tools/{patman => u_boot_pylib}/tools.py (99%)
 rename tools/{patman => u_boot_pylib}/tout.py (99%)
 create mode 120000 tools/u_boot_pylib/u_boot_pylib
Signature · 1 line
2.39.2.637.g21b0678d19-goog