From dbe4b77947dd5ea4bff1f63bd93f283fb7a56984 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Jul 29 2024 09:45:38 +0000 Subject: Various package data fixes in setup.py patch - Make setup.py more similar to the upstream pyproject.toml - Add a glob() function and use it for globbing instead of relying on setuptools to do it for us as setuptools doesn't do recursive globs in the version shipped in CentOS Stream 9. --- diff --git a/add-back-setup.py-file.patch b/add-back-setup.py-file.patch index c8e3f8a..4b7393c 100644 --- a/add-back-setup.py-file.patch +++ b/add-back-setup.py-file.patch @@ -18,11 +18,15 @@ new file mode 100644 index 0000000..077691d --- /dev/null +++ b/setup.py -@@ -0,0 +1,19 @@ +@@ -0,0 +1,26 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: LGPL-2.1+ + +from setuptools import setup, find_packages ++from pathlib import Path ++ ++def glob(glob: str) -> list[str]: ++ return [str(p.relative_to("mkosi/resources")) for p in Path("mkosi/resources").glob(glob) if p.is_file()] + +setup( + name="mkosi", @@ -33,8 +37,11 @@ index 0000000..077691d + maintainer_email="systemd-devel@lists.freedesktop.org", + license="LGPLv2+", + python_requires=">=3.9", -+ packages = find_packages(".", exclude=["tests"]), -+ package_data = {"": ["repart/**/*", "mkosi.md", "mkosi.1", "mkosi-initrd/**/*", "mkosi-tools/**/*", "mkosi-initrd.md", "mkosi-initrd.1"]}, ++ packages = ["mkosi", "mkosi.distributions", "mkosi.initrd", "mkosi.initrd.resources", "mkosi.installer", "mkosi.resources"], ++ package_data = { ++ "mkosi.resources": [*glob("repart/**/*"), "mkosi.md", "mkosi.1", *glob("mkosi-initrd/**/*"), *glob("mkosi-tools/**/*")], ++ "mkosi.initrd": ["mkosi-initrd.md", "mkosi-initrd.1"], ++ }, + include_package_data = True, + entry_points = { "console_scripts": ["mkosi = mkosi.__main__:main", "mkosi-initrd = mkosi.initrd.__main__:main"] }, +) diff --git a/mkosi.spec b/mkosi.spec index 4d45f22..89a94da 100644 --- a/mkosi.spec +++ b/mkosi.spec @@ -1,6 +1,6 @@ Name: mkosi Version: 24 -Release: 1.1%{?dist} +Release: 1.2%{?dist} Summary: Create bespoke OS images License: LGPL-2.1-or-later