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-*.tar.gz
/chardet-2.2.1.tar.gz /chardet-*/
/chardet-2.3.0.tar.gz
/chardet-3.0.4.tar.gz
/chardet-4.0.0.tar.gz

View File

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