diff --git a/utils/generate-cyclonedx b/utils/generate-cyclonedx index 4166abd9ff..611a20127d 100755 --- a/utils/generate-cyclonedx +++ b/utils/generate-cyclonedx @@ -9,8 +9,6 @@ import argparse -import bz2 -import gzip import json import os from pathlib import Path @@ -179,7 +177,7 @@ def patch_retrieve_header(content: str) -> str: def read_patch_file(patch_path: Path) -> str: - """Read the content of a patch file, handling compression. + """Read the content of a patch file. Args: patch_path (Path): Patch path. @@ -187,16 +185,8 @@ def read_patch_file(patch_path: Path) -> str: Returns: str: Patch content. """ - if patch_path.suffix == ".gz": - f = gzip.open(patch_path, mode="rt") - elif patch_path.suffix == ".bz": - f = bz2.open(patch_path, mode="rt") - else: - f = open(patch_path) - - content = f.read() - f.close() - return content + with open(patch_path) as f: + return f.read() def cyclonedx_patches(patch_list: list[str]):