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

Simon Glass sjg at chromium.org
Fri Feb 24 02:18:00 CET 2023


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

-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list