]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
rpm: use Path.as_uri() in one more place 2398/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 16 Feb 2024 17:10:45 +0000 (18:10 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 16 Feb 2024 17:11:48 +0000 (18:11 +0100)
mkosi/installer/rpm.py

index cac43b5636aba82484e78a4e3b1c5754b416d3dd..18da69cc1cbadbafe665d95fce06d76649dadc92 100644 (file)
@@ -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