Blob Blame History Raw
Name:           python-chardet
Version:        4.0.0
Release:        %autorelease
Summary:        Character encoding auto-detection in Python
License:        LGPLv2
URL:            https://github.com/chardet/chardet
Source0:        %{pypi_source chardet}

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  pyproject-rpm-macros

# Circular dependency on pytest
%bcond_without tests
%if %{with tests}
BuildRequires:  python3-pytest
%endif

%global _description\
Character encoding auto-detection in Python. As\
smart as your browser. Open source.

%description %_description


%package -n python3-chardet
Summary:        %{summary}

%description -n python3-chardet %_description


%prep
%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
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files chardet


%if %{with tests}
%check
%pytest -v
%endif


%files -n python3-chardet -f %{pyproject_files}
%license LICENSE
%doc README.rst
%{_bindir}/chardetect


%changelog
%autochangelog