python-chardet/python-chardet.spec
2022-06-25 10:08:20 -04:00

82 lines
1.7 KiB
RPMSpec

Name: python-chardet
Version: 4.0.0
Release: %autorelease
Summary: Character encoding auto-detection in Python
# The entire source is LGPLv2+, except:
#
# - tests/ascii/howto.diveintomark.org.xml is CC-BY-SA (but is not installed)
#
# See also:
# clarify Trove license classifier
# https://github.com/chardet/chardet/issues/162
# Clarify LGPL version in License trove classifier
# https://github.com/chardet/chardet/pull/255
License: LGPLv2+
URL: https://github.com/chardet/chardet
Source0: %{pypi_source chardet}
# Hand-written for Fedora in groff_man(7) format based on --help output
Source1: chardetect.1
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
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}'
%if %{with tests}
%check
%pytest -v
%endif
%files -n python3-chardet -f %{pyproject_files}
%license LICENSE
%doc README.rst
%{_bindir}/chardetect
%{_mandir}/man1/chardetect.1*
%changelog
%autochangelog