From f563be52a096e3bb8644330d2e89f84c551853dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 16 Feb 2024 18:10:45 +0100 Subject: [PATCH] rpm: use Path.as_uri() in one more place --- mkosi/installer/rpm.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mkosi/installer/rpm.py b/mkosi/installer/rpm.py index cac43b563..18da69cc1 100644 --- a/mkosi/installer/rpm.py +++ b/mkosi/installer/rpm.py @@ -20,13 +20,11 @@ class RpmRepository(NamedTuple): def find_rpm_gpgkey(context: Context, key: str) -> Optional[str]: - gpgpath = next((context.config.tools() / "usr/share/distribution-gpg-keys").rglob(key), None) - if gpgpath: - return f"file://{Path('/') / gpgpath.relative_to(context.config.tools())}" + if gpgpath := next((context.config.tools() / "usr/share/distribution-gpg-keys").rglob(key), None): + return ('/' / gpgpath.relative_to(context.config.tools())).as_uri() - gpgpath = next(Path(context.pkgmngr / "etc/pki/rpm-gpg").rglob(key), None) - if gpgpath: - return f"file://{Path('/') / gpgpath.relative_to(context.pkgmngr)}" + if gpgpath := next(Path(context.pkgmngr / "etc/pki/rpm-gpg").rglob(key), None): + return ('/' / gpgpath.relative_to(context.pkgmngr)).as_uri() return None -- 2.47.2