[PATCH 09/15] buildman: Add support for building a buildman PyPi package

Simon Glass sjg at chromium.org
Sun Feb 19 15:51:17 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. It is included for completeness, since adding
this later would be more trouble.

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/buildman/main.py        | 27 ++++++++++++++++-----------
 tools/buildman/pyproject.toml | 29 +++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 11 deletions(-)
 create mode 100644 tools/buildman/pyproject.toml

diff --git a/Makefile b/Makefile
index afa6a7eb127..9f9d55e77ee 100644
--- a/Makefile
+++ b/Makefile
@@ -2283,6 +2283,7 @@ pip pip_test pip_release: _pip
 _pip:
 	scripts/make_pip.sh u_boot_pylib ${PIP_ARGS}
 	scripts/make_pip.sh patmanu ${PIP_ARGS}
+	scripts/make_pip.sh buildman ${PIP_ARGS}
 
 help:
 	@echo  'Cleaning targets:'
diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index 4a4945ca5d4..249e02d2998 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -46,17 +46,22 @@ def RunTests(skip_net_tests, verboose, args):
 
     return (0 if result.wasSuccessful() else 1)
 
-options, args = cmdline.ParseArgs()
+def run_buildman():
+    options, args = cmdline.ParseArgs()
 
-if not options.debug:
-    sys.tracebacklimit = 0
+    if not options.debug:
+        sys.tracebacklimit = 0
 
-# Run our meagre tests
-if options.test:
-    RunTests(options.skip_net_tests, options.verbose, args)
+    # Run our meagre tests
+    if options.test:
+        RunTests(options.skip_net_tests, options.verbose, args)
 
-# Build selected commits for selected boards
-else:
-    bsettings.Setup(options.config_file)
-    ret_code = control.DoBuildman(options, args)
-    sys.exit(ret_code)
+    # Build selected commits for selected boards
+    else:
+        bsettings.Setup(options.config_file)
+        ret_code = control.DoBuildman(options, args)
+        sys.exit(ret_code)
+
+
+if __name__ == "__main__":
+    run_buildman()
diff --git a/tools/buildman/pyproject.toml b/tools/buildman/pyproject.toml
new file mode 100644
index 00000000000..df06b2b2917
--- /dev/null
+++ b/tools/buildman/pyproject.toml
@@ -0,0 +1,29 @@
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "buildman"
+version = "0.0.1"
+authors = [
+  { name="Simon Glass", email="sjg at chromium.org" },
+]
+dependencies = ["u_boot_pylib", "patmanu"]
+description = "Buildman build tool for U-Boot"
+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/build/buildman.html"
+"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
+
+[project.scripts]
+buildman = "buildman.main:run_buildman"
+
+[tool.setuptools.package-data]
+buildman = ["*.rst"]
-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list