From 73037ec629f34a0708ac71e3909bf16af1ca8c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 5 Feb 2021 12:03:12 +0100 Subject: [PATCH] Convert to pyproject-rpm-macros --- .gitignore | 7 ++----- python-chardet.spec | 40 +++++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index c0db42f..bb18b7a 100644 --- a/.gitignore +++ b/.gitignore @@ -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-*/ diff --git a/python-chardet.spec b/python-chardet.spec index d56763d..cb8a3ec 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -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