[PATCH 12/15] binman: Add support for building a binmanu PyPi package

Simon Glass sjg at chromium.org
Sun Feb 19 15:51:20 CET 2023


Create the necessary files to build this new package.

It is not actually clear whether this is useful, since buildman has no
purpose outside U-Boot.

Move the main program into a function so that it can easily be called by
the PyPi-created script.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 Makefile                     |  1 +
 tools/binmanu/main.py        |  6 +++++-
 tools/binmanu/pyproject.toml | 31 +++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 tools/binmanu/pyproject.toml

diff --git a/Makefile b/Makefile
index 86c85c70999..593e3629336 100644
--- a/Makefile
+++ b/Makefile
@@ -2285,6 +2285,7 @@ _pip:
 	scripts/make_pip.sh patmanu ${PIP_ARGS}
 	scripts/make_pip.sh buildman ${PIP_ARGS}
 	scripts/make_pip.sh dtoc ${PIP_ARGS}
+	scripts/make_pip.sh binmanu ${PIP_ARGS}
 
 help:
 	@echo  'Cleaning targets:'
diff --git a/tools/binmanu/main.py b/tools/binmanu/main.py
index 813343f2fda..9f33e11f4f0 100755
--- a/tools/binmanu/main.py
+++ b/tools/binmanu/main.py
@@ -141,8 +141,12 @@ def RunBinman(args):
     return ret_code
 
 
-if __name__ == "__main__":
+def start_binman():
     args = cmdline.ParseArgs(sys.argv[1:])
 
     ret_code = RunBinman(args)
     sys.exit(ret_code)
+
+
+if __name__ == "__main__":
+    start_binman()
diff --git a/tools/binmanu/pyproject.toml b/tools/binmanu/pyproject.toml
new file mode 100644
index 00000000000..a32fae7d3cb
--- /dev/null
+++ b/tools/binmanu/pyproject.toml
@@ -0,0 +1,31 @@
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "binmanu"
+version = "0.0.1"
+authors = [
+  { name="Simon Glass", email="sjg at chromium.org" },
+]
+dependencies = ["pylibfdt", "u_boot_pylib", "dtoc"]
+description = "Binman firmware-packaging tool"
+readme = "README.rst"
+requires-python = ">=3.7"
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
+    "Operating System :: OS Independent",
+]
+
+[project.urls]
+"Homepage" = "https://u-boot.readthedocs.io/en/latest/develop/package/index.html"
+"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
+
+[project.scripts]
+binman = "binmanu.main:start_binman"
+
+#[tool.setuptools]
+#packages=['binmanu', 'binmanu.etype', 'binmanu.btool']
+[tool.setuptools.packages.find]
+where = ["src"]
-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list