Compare commits

..

9 commits

Author SHA1 Message Date
Benjamin A. Beasley
2652ef7c53 Fix get_source_script 2022-06-25 13:00:00 -04:00
Benjamin A. Beasley
500fd9ab06 Drop test data with problematic license status 2022-06-25 12:56:44 -04:00
Benjamin A. Beasley
0859683087 BR python3dist(hypothesis) to enable more tests 2022-06-25 11:18:32 -04:00
Benjamin A. Beasley
d4143c12d2 Package Sphinx-generated PDF in a -doc subpackage 2022-06-25 11:18:31 -04:00
Benjamin A. Beasley
97d0054fb4 Drop explicit pyproject-rpm-macros BR 2022-06-25 11:18:30 -04:00
Benjamin A. Beasley
d8cc36cf0b Update summary and description from upstream 2022-06-25 11:18:29 -04:00
Benjamin A. Beasley
169faa9cf3 Add a man page for the chardetect command 2022-06-25 11:18:28 -04:00
Benjamin A. Beasley
57e33703ed Correct License from LGPLv2 to LGPLv2+ 2022-06-25 11:18:27 -04:00
Benjamin A. Beasley
6f491bfe59 Opt in to rpmautospec 2022-06-25 11:18:19 -04:00
7 changed files with 77 additions and 61 deletions

4
.gitignore vendored
View file

@ -1,7 +1,3 @@
/chardet-*.tar.gz
/chardet-*/
/chardet-4.0.0-filtered.tar.xz
/chardet-5.0.0-filtered.tar.xz
/chardet-5.1.0-filtered.tar.xz
/chardet-5.2.0-filtered.tar.xz
/chardet-5.2.0-filtered.tar.zst

View file

@ -1,12 +1,3 @@
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 4.0.0-7
- Rebuilt for Python 3.11
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 4.0.0-6
- Bootstrap for Python 3.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

View file

@ -19,11 +19,5 @@ File whose encoding we would like to determine.
.B \-h\fR, \fB\-\-help
show a help message and exit
.TP
.B \-\-minimal
Print only the encoding to standard output
.TP
.B \-l\fR, \fB\-\-legacy
Rename legacy encodings to more modern ones.
.TP
.B \-\-version
show program\(cqs version number and exit

View file

@ -26,23 +26,9 @@ ARCHIVE="$(find . -mindepth 1 -maxdepth 1 -type f -name '*.tar.gz' -print -quit)
echo "--> Extracting: $(basename "${ARCHIVE}")" 1>&2
tar -xzf "${ARCHIVE}"
echo '--> Removing tests due to licensing issues' 1>&2
TARDIR="$(basename "${ARCHIVE}" '.tar.gz')"
MTIME="$(stat -c '%Y' "${TARDIR}")"
rm -rvf "${TARDIR}/tests/"
# Restore the original mtime even though we modified the base directory by
# removing the tests.
touch -d @"${MTIME}" "${TARDIR}"
FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.zst"
rm -rvf */tests/
FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.xz"
echo "--> Re-archiving: ${FILTERED}" 1>&2
# https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html
TZ=UTC LC_ALL=C tar \
--create --verbose \
--sort=name \
--format=posix \
--numeric-owner --owner=0 --group=0 \
--mode=go+u,go-w \
--pax-option='delete=atime,delete=ctime' \
"${TARDIR}/" |
zstdmt --ultra -22 > "${FILTERED}"
tar -c "${FILTERED}" */ | xz -9e > "${FILTERED}"
mv -v "${FILTERED}" "${OUTDIR}"
echo 'Done.' 1>&2

View file

@ -1,11 +0,0 @@
# Not a real spelling error:
addFilter(r" spelling-error \('([Pp]rober)s?',")
# This Source cannot be a URL because we must filter out certain files.
addFilter(r" invalid-url Source[0-9]+: chardet-.*-filtered\.tar\.zst")
# Bogus; it is a perfectly fine zstandard file.
addFilter(r" inconsistent-file-extension chardet-.*-filtered\.tar\.zst$")
# The -doc subpackage was removed without an equivalent replacement.
addFilter(r" obsolete-not-provided python-chardet-doc$")
# Update LGPLv2.1 license text and notices for remote-only FSF
# https://github.com/chardet/chardet/pull/307
addFilter(r" incorrect-fsf-address ")

View file

@ -1,11 +1,23 @@
# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond_without doc_pdf
Name: python-chardet
Version: 5.2.0
Version: 4.0.0
Release: %autorelease
Summary: Python character encoding detector
# The entire source, after tests/ are filtered, is LGPL-2.0-or-later. See the
# comment above Source0 for more details on tests/.
License: LGPL-2.0-or-later
# The entire source, after tests/ are filtered, is LGPLv2+. See the comment
# above Source0 for more details on tests/.
#
# 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
# A filtered source tarball, obtained by (see Source1):
#
@ -16,16 +28,25 @@ URL: https://github.com/chardet/chardet
#
# problematic licensing of /tests?
# https://github.com/chardet/chardet/issues/231
Source0: chardet-%{version}-filtered.tar.zst
Source0: chardet-%{version}-filtered.tar.xz
Source1: get_source
# Hand-written for Fedora in groff_man(7) format based on --help output
Source2: chardetect.1
BuildSystem: pyproject
BuildOption(install): -l chardet
BuildArch: noarch
BuildRequires: python3-devel
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
BuildRequires: tex-xetex-bin
BuildRequires: /usr/bin/xindy
%endif
%global common_description %{expand:
Chardet: The Universal Character Encoding Detector
@ -53,26 +74,65 @@ disabled.}
%package -n python3-chardet
Summary: %{summary}
# Removed in F41:
Obsoletes: python-chardet-doc < 5.2.0-12
%description -n python3-chardet
%{common_description}
%install -a
%package doc
Summary: Documentation for python-chardet
%description doc
%{common_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"
# Since pdflatex cannot handle Unicode inputs in general:
echo "latex_engine = 'xelatex'" >> docs/conf.py
%generate_buildrequires
%pyproject_buildrequires
%build
%pyproject_wheel
%if %{with doc_pdf}
PYTHONPATH="${PWD}" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
%endif
%install
%pyproject_install
%pyproject_save_files chardet
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE2}'
%check
# We cannot run the upstream tests because they would require data files with
# problematic license status.
%pyproject_check_import
%files -n python3-chardet -f %{pyproject_files}
%doc README.rst
%{_bindir}/chardetect
%{_mandir}/man1/chardetect.1*
%files doc
%license LICENSE
%doc README.rst
%if %{with doc_pdf}
%doc docs/_build/latex/chardet.pdf
%endif
%changelog
%autochangelog

View file

@ -1 +1 @@
SHA512 (chardet-5.2.0-filtered.tar.zst) = 410b2d62c54781f9b848ee78c659d4607bbb7f94f6117d7fa7cd5f82a50dfaf10d6e4c6dfaefa9b9a721b846c167aa12eae029debbaa66b0d830875c8ce5749c
SHA512 (chardet-4.0.0-filtered.tar.xz) = 4c41d5f9311e6796a3270b5ecd63abc51e52962c97a7599e8756e82ba97998306e2e841e14da96441a63c446fa9142534bac7154579822b55882e621f3bbe2e0