Files
python-lz4/python-lz4.spec
2026-02-02 11:12:03 +08:00

86 lines
2.0 KiB
RPMSpec

# SPDX-FileCopyrightText: (C) 2026 Institute of Software, Chinese Academy of Sciences (ISCAS)
# SPDX-FileCopyrightText: (C) 2026 openRuyi Project Contributors
# SPDX-FileContributor: CHEN Xuan <chenxuan@iscas.ac.cn>
#
# SPDX-License-Identifier: MulanPSL-2.0
%bcond doc 0
%bcond tox_test 0
%global srcname lz4
Name: python-%{srcname}
Version: 4.4.4
Release: %autorelease
# Automatically converted from old format: BSD - review is highly recommended.
License: LicenseRef-Callaway-BSD
Summary: LZ4 Bindings for Python
URL: https://github.com/%{name}/%{name}
#!RemoteAsset
Source: https://files.pythonhosted.org/packages/source/l/%{srcname}/%{srcname}-%{version}.tar.gz
BuildSystem: pyproject
BuildOption(install): %{srcname}
# Reduce setuptools_scm dep to >= 6
Patch: 0001-python-lz4-deps.patch
# Support Python 3.14
# https://github.com/python-lz4/python-lz4/pull/303.patch
Patch1: 0002-correct-import-of-_compression.patch
%if %{without tox_test}
Patch2: 0003-remove-tox-temp.patch
%endif
BuildRequires: pkgconfig(liblz4)
BuildRequires: python3-devel
# For tests
%if %{with tox_test}
BuildRequires: python3dist(psutil)
%endif
# TODO: For docs
# BuildRequires: python3-sphinx
# BuildRequires: python3-sphinx-bootstrap-theme
%description
Python bindings for the lz4 compression library.
Provides: python3-%{srcname}
%python_provide python3-%{srcname}
%prep -a
sed -i -e '/pytest-cov/d' setup.py
%if %{with tox_test}
sed -i -e 's/--cov=lz4\/block --cov=lz4\/frame//' tox.ini
%endif
rm lz4libs/lz4*.[ch]
%generate_buildrequires
%pyproject_buildrequires -t
%install -a
# Fix permissions on shared objects
find %{buildroot}%{python3_sitearch} -name 'lz4*.so' \
-exec chmod 0755 {} \;
%if %{with doc}
# Build HTML docs
pushd docs
PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch} make html
popd
mv docs/_build/html ./html
%endif
%check
%if %{with test}
%tox
%endif
:
%files -f %{pyproject_files}
%license LICENSE
%doc README.rst %{?with_doc:html}
%changelog
%autochangelog