diff --git a/pyproject.toml b/pyproject.toml index cd2b373..26ff1a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "python-dateutil>=2.8.1,<3", "botocore>=1.23.50,<2", "lxml>=4.6.5,<5", - "zstd>=1.5.5.1", + "zstandard>=0.21.0", ] [project.optional-dependencies] diff --git a/rpm_s3_mirror.spec b/rpm_s3_mirror.spec index 3064a01..6aad818 100644 --- a/rpm_s3_mirror.spec +++ b/rpm_s3_mirror.spec @@ -13,7 +13,7 @@ Requires: python3-requests Requires: python3-dateutil Requires: python3-botocore Requires: python3-lxml -Requires: python3-zstd +Requires: python3-zstandard Requires: systemd Requires: zchunk diff --git a/rpm_s3_mirror/repository.py b/rpm_s3_mirror/repository.py index b88806b..424d0df 100644 --- a/rpm_s3_mirror/repository.py +++ b/rpm_s3_mirror/repository.py @@ -1,7 +1,7 @@ # Copyright (c) 2020 Aiven, Helsinki, Finland. https://aiven.io/ import dataclasses import lzma -import zstd +import zstandard import re import subprocess from abc import abstractmethod @@ -215,9 +215,9 @@ def _compress(self, root, open_size, open_checksum): def decompress(filename: Path | str) -> bytes: try: - with open(filename, "rb") as f: - return zstd.decompress(f.read()) - except zstd.Error: + with zstandard.open(filename) as f: + return f.read() + except zstandard.ZstdError: with gzip.open(filename) as f: return f.read()