Convert to pyproject-rpm-macros

This commit is contained in:
Miro Hrončok 2021-02-05 12:03:12 +01:00
parent 6770299bbc
commit 73037ec629
2 changed files with 25 additions and 22 deletions

7
.gitignore vendored
View File

@ -1,5 +1,2 @@
python2-chardet-2.0.1.tgz
/chardet-2.2.1.tar.gz
/chardet-2.3.0.tar.gz
/chardet-3.0.4.tar.gz
/chardet-4.0.0.tar.gz
/chardet-*.tar.gz
/chardet-*/

View File

@ -1,16 +1,15 @@
%global pypi_name chardet
Name: python-%{pypi_name}
Name: python-chardet
Version: 4.0.0
Release: 1%{?dist}
Summary: Character encoding auto-detection in Python
License: LGPLv2
URL: https://github.com/%{pypi_name}/%{pypi_name}
Source0: %pypi_source
URL: https://github.com/chardet/chardet
Source0: %{pypi_source chardet}
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: pyproject-rpm-macros
# Circular dependency on pytest
%bcond_without tests
@ -18,42 +17,49 @@ BuildRequires: python3-setuptools
BuildRequires: python3-pytest
%endif
%global _description\
Character encoding auto-detection in Python. As\
smart as your browser. Open source.
%description %_description
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name} %_description
%package -n python3-chardet
Summary: %{summary}
%description -n python3-chardet %_description
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%autosetup -p1 -n chardet-%{version}
# Remove useless shebangs
# https://github.com/chardet/chardet/commit/1e94b33329
grep -lr "^#\!/usr/bin/env python" chardet/ | xargs sed -i "1d"
%generate_buildrequires
%pyproject_buildrequires -r
%build
%py3_build
%pyproject_wheel
%install
%py3_install
%pyproject_install
%pyproject_save_files chardet
%if %{with tests}
%check
%{__python3} -m pytest -v
%pytest -v
%endif
%files -n python3-%{pypi_name}
%files -n python3-chardet -f %{pyproject_files}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%{_bindir}/chardetect