From 8b1e743120f9e4ff26e81fb3e7ae93bd5c4fa4f7 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 15 Apr 2024 19:25:27 +0200 Subject: [PATCH] tools/osbuild-depsolve-dnf(5): use url.path to drop scheme str.removeprefix() is not available in Python 3.6, which we need to support EL8. Instead of removing the prefix from the original path string, take the path property of the parsed URL. Since we're dealing with file paths, there will be no params, query, or fragment strings so the path should be all we need. --- tools/osbuild-depsolve-dnf | 2 +- tools/osbuild-depsolve-dnf5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/osbuild-depsolve-dnf b/tools/osbuild-depsolve-dnf index dbffdb59..d652bfe2 100755 --- a/tools/osbuild-depsolve-dnf +++ b/tools/osbuild-depsolve-dnf @@ -326,7 +326,7 @@ def read_keys(paths, root_dir=None): for path in paths: url = urllib.parse.urlparse(path) if url.scheme == "file": - path = path.removeprefix("file://") + path = url.path path = modify_rootdir_path(path, root_dir) try: with open(path, mode="r", encoding="utf-8") as keyfile: diff --git a/tools/osbuild-depsolve-dnf5 b/tools/osbuild-depsolve-dnf5 index afac612e..8d3885a9 100755 --- a/tools/osbuild-depsolve-dnf5 +++ b/tools/osbuild-depsolve-dnf5 @@ -468,7 +468,7 @@ def read_keys(paths, root_dir=None): for path in paths: url = urllib.parse.urlparse(path) if url.scheme == "file": - path = path.removeprefix("file://") + path = url.path path = modify_rootdir_path(path, root_dir) try: with open(path, mode="r", encoding="utf-8") as keyfile: