From: Daan De Meyer Date: Fri, 2 Jun 2023 12:25:21 +0000 (+0200) Subject: Drop unused functions X-Git-Tag: v15~126^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1608%2Fhead;p=thirdparty%2Fmkosi.git Drop unused functions --- diff --git a/mkosi/config.py b/mkosi/config.py index 1f3c738ff..3c526e60f 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -2102,19 +2102,6 @@ class GenericVersion: return run(cmd, check=False).returncode == 0 -def strip_suffixes(path: Path) -> Path: - while path.suffix in { - ".xz", - ".zstd", - ".raw", - ".tar", - ".cpio", - }: - path = path.with_suffix("") - - return path - - def find_image_version(args: argparse.Namespace) -> None: if args.image_version is not None: return diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index af4338886..84f84dfdf 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -3,8 +3,6 @@ import logging import os import shutil -import urllib.parse -import urllib.request from collections.abc import Iterable, Mapping, Sequence from pathlib import Path from textwrap import dedent @@ -115,16 +113,6 @@ def fedora_release_at_least(release: str, threshold: str) -> bool: return int(release) >= int(threshold) -def url_exists(url: str) -> bool: - req = urllib.request.Request(url, method="HEAD") - try: - if urllib.request.urlopen(req): - return True - except Exception: - pass - return False - - class Repo(NamedTuple): id: str url: str diff --git a/mkosi/log.py b/mkosi/log.py index 8cdfef70e..0ab40c142 100644 --- a/mkosi/log.py +++ b/mkosi/log.py @@ -32,10 +32,6 @@ def color_error(text: Any) -> str: return f"{Style.red}{text}{Style.reset}" -def color_warning(text: Any) -> str: - return f"{Style.yellow}{text}{Style.reset}" - - def log_step(text: str) -> None: prefix = " " * LEVEL diff --git a/tests/test_config.py b/tests/test_config.py deleted file mode 100644 index 26350c360..000000000 --- a/tests/test_config.py +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ - -from pathlib import Path - -from mkosi.config import strip_suffixes - - -def test_strip_suffixes() -> None: - assert strip_suffixes(Path("home/test.zstd")) == Path("home/test") - assert strip_suffixes(Path("home/test.xz")) == Path("home/test") - assert strip_suffixes(Path("home/test.raw")) == Path("home/test") - assert strip_suffixes(Path("home/test.tar")) == Path("home/test") - assert strip_suffixes(Path("home/test.cpio")) == Path("home/test") - assert strip_suffixes(Path("home.xz/test.xz")) == Path("home.xz/test") - assert strip_suffixes(Path("home.xz/test")) == Path("home.xz/test") - assert strip_suffixes(Path("home.xz/test.txt")) == Path("home.xz/test.txt")