From 6f491bfe59298dddc4752846bd3c7665bd8d35ba Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 11:18:19 -0400 Subject: [PATCH 1/9] Opt in to rpmautospec --- changelog | 134 +++++++++++++++++++++++++++++++++++++++++++ python-chardet.spec | 137 +------------------------------------------- 2 files changed, 136 insertions(+), 135 deletions(-) create mode 100644 changelog diff --git a/changelog b/changelog new file mode 100644 index 0000000..50d0a1f --- /dev/null +++ b/changelog @@ -0,0 +1,134 @@ +* Fri Jul 23 2021 Fedora Release Engineering - 4.0.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jun 02 2021 Python Maint - 4.0.0-3 +- Rebuilt for Python 3.10 + +* Wed Jun 02 2021 Python Maint - 4.0.0-2 +- Bootstrap for Python 3.10 + +* Fri Feb 05 2021 Miro Hrončok - 4.0.0-1 +- Update to 4.0.0 +- Fixes: rhbz#1906585 +- Fixes: rhbz#1923076 + +* Wed Jan 27 2021 Fedora Release Engineering - 3.0.4-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 3.0.4-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri May 22 2020 Miro Hrončok - 3.0.4-17 +- Rebuilt for Python 3.9 + +* Fri May 22 2020 Miro Hrončok - 3.0.4-16 +- Bootstrap for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 3.0.4-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Nov 14 2019 Miro Hrončok - 3.0.4-14 +- Subpackage python2-chardet has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Thu Oct 03 2019 Miro Hrončok - 3.0.4-13 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Thu Aug 15 2019 Miro Hrončok - 3.0.4-12 +- Rebuilt for Python 3.8 + +* Wed Aug 14 2019 Miro Hrončok - 3.0.4-11 +- Bootstrap for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 3.0.4-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 3.0.4-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Aug 17 2018 Miro Hrončok - 3.0.4-8 +- Only have one /usr/bin/chardetect + +* Fri Jul 13 2018 Fedora Release Engineering - 3.0.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Jun 13 2018 Miro Hrončok - 3.0.4-6 +- Rebuilt for Python 3.7 + +* Sun Feb 11 2018 Iryna Shcherbina - 3.0.4-5 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 3.0.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 3.0.4-3 +- Python 2 binary package renamed to python2-chardet + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Jul 27 2017 Fedora Release Engineering - 3.0.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue Jun 20 2017 Jeremy Cline - 3.0.4-1 +- Update to 3.0.4 (#1441436) + +* Sat Feb 11 2017 Fedora Release Engineering - 2.3.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Dec 09 2016 Charalampos Stratakis - 2.3.0-2 +- Rebuild for Python 3.6 + +* Wed Jul 27 2016 Miro Hrončok - 2.3.0-1 +- Update to 2.3.0 (#1150536) + +* Tue Jul 19 2016 Fedora Release Engineering - 2.2.1-6 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 2.2.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Oct 14 2015 Robert Kuska - 2.2.1-4 +- Rebuilt for Python3.5 rebuild + +* Thu Jun 18 2015 Fedora Release Engineering - 2.2.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Jul 31 2014 Tom Callaway - 2.2.1-2 +- fix license handling + +* Wed Jul 02 2014 Miro Hrončok - 2.2.1-1 +- Updated to 2.2.1 +- Introduced Python 3 subpackage (upstream has merged the codebase) +- Removed BuildRoot and python_sitelib definition +- Use python2 macros instead of just python + +* Sat Jun 07 2014 Fedora Release Engineering - 2.0.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 2.0.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 2.0.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jul 21 2012 Fedora Release Engineering - 2.0.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 2.0.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 2.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jul 21 2010 David Malcolm - 2.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Wed Jan 13 2010 Kushal Das 2.0.1-1 +- New release + +* Sun Jul 26 2009 Fedora Release Engineering - 1.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Aug 04 2008 Kushal Das 1.0.1-1 +- Initial release + diff --git a/python-chardet.spec b/python-chardet.spec index dc4b581..97e379c 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -1,6 +1,6 @@ Name: python-chardet Version: 4.0.0 -Release: 4%{?dist} +Release: %autorelease Summary: Character encoding auto-detection in Python License: LGPLv2 URL: https://github.com/chardet/chardet @@ -64,137 +64,4 @@ grep -lr "^#\!/usr/bin/env python" chardet/ | xargs sed -i "1d" %changelog -* Fri Jul 23 2021 Fedora Release Engineering - 4.0.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Wed Jun 02 2021 Python Maint - 4.0.0-3 -- Rebuilt for Python 3.10 - -* Wed Jun 02 2021 Python Maint - 4.0.0-2 -- Bootstrap for Python 3.10 - -* Fri Feb 05 2021 Miro Hrončok - 4.0.0-1 -- Update to 4.0.0 -- Fixes: rhbz#1906585 -- Fixes: rhbz#1923076 - -* Wed Jan 27 2021 Fedora Release Engineering - 3.0.4-19 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Wed Jul 29 2020 Fedora Release Engineering - 3.0.4-18 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Fri May 22 2020 Miro Hrončok - 3.0.4-17 -- Rebuilt for Python 3.9 - -* Fri May 22 2020 Miro Hrončok - 3.0.4-16 -- Bootstrap for Python 3.9 - -* Thu Jan 30 2020 Fedora Release Engineering - 3.0.4-15 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Thu Nov 14 2019 Miro Hrončok - 3.0.4-14 -- Subpackage python2-chardet has been removed - See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal - -* Thu Oct 03 2019 Miro Hrončok - 3.0.4-13 -- Rebuilt for Python 3.8.0rc1 (#1748018) - -* Thu Aug 15 2019 Miro Hrončok - 3.0.4-12 -- Rebuilt for Python 3.8 - -* Wed Aug 14 2019 Miro Hrončok - 3.0.4-11 -- Bootstrap for Python 3.8 - -* Fri Jul 26 2019 Fedora Release Engineering - 3.0.4-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Sat Feb 02 2019 Fedora Release Engineering - 3.0.4-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Aug 17 2018 Miro Hrončok - 3.0.4-8 -- Only have one /usr/bin/chardetect - -* Fri Jul 13 2018 Fedora Release Engineering - 3.0.4-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Jun 13 2018 Miro Hrončok - 3.0.4-6 -- Rebuilt for Python 3.7 - -* Sun Feb 11 2018 Iryna Shcherbina - 3.0.4-5 -- Update Python 2 dependency declarations to new packaging standards - (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) - -* Fri Feb 09 2018 Fedora Release Engineering - 3.0.4-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 3.0.4-3 -- Python 2 binary package renamed to python2-chardet - See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 - -* Thu Jul 27 2017 Fedora Release Engineering - 3.0.4-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Tue Jun 20 2017 Jeremy Cline - 3.0.4-1 -- Update to 3.0.4 (#1441436) - -* Sat Feb 11 2017 Fedora Release Engineering - 2.3.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Fri Dec 09 2016 Charalampos Stratakis - 2.3.0-2 -- Rebuild for Python 3.6 - -* Wed Jul 27 2016 Miro Hrončok - 2.3.0-1 -- Update to 2.3.0 (#1150536) - -* Tue Jul 19 2016 Fedora Release Engineering - 2.2.1-6 -- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages - -* Thu Feb 04 2016 Fedora Release Engineering - 2.2.1-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Wed Oct 14 2015 Robert Kuska - 2.2.1-4 -- Rebuilt for Python3.5 rebuild - -* Thu Jun 18 2015 Fedora Release Engineering - 2.2.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Thu Jul 31 2014 Tom Callaway - 2.2.1-2 -- fix license handling - -* Wed Jul 02 2014 Miro Hrončok - 2.2.1-1 -- Updated to 2.2.1 -- Introduced Python 3 subpackage (upstream has merged the codebase) -- Removed BuildRoot and python_sitelib definition -- Use python2 macros instead of just python - -* Sat Jun 07 2014 Fedora Release Engineering - 2.0.1-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Sun Aug 04 2013 Fedora Release Engineering - 2.0.1-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Thu Feb 14 2013 Fedora Release Engineering - 2.0.1-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Sat Jul 21 2012 Fedora Release Engineering - 2.0.1-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Sat Jan 14 2012 Fedora Release Engineering - 2.0.1-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Tue Feb 08 2011 Fedora Release Engineering - 2.0.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Wed Jul 21 2010 David Malcolm - 2.0.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild - -* Wed Jan 13 2010 Kushal Das 2.0.1-1 -- New release - -* Sun Jul 26 2009 Fedora Release Engineering - 1.0.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Mon Aug 04 2008 Kushal Das 1.0.1-1 -- Initial release - +%autochangelog From 57e33703edc80c42c76a0f214149ba7c07d3da65 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 10:01:11 -0400 Subject: [PATCH 2/9] Correct License from LGPLv2 to LGPLv2+ --- python-chardet.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python-chardet.spec b/python-chardet.spec index 97e379c..68b209e 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -2,7 +2,17 @@ Name: python-chardet Version: 4.0.0 Release: %autorelease Summary: Character encoding auto-detection in Python -License: LGPLv2 + +# 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} From 169faa9cf3452f12c086d6c0754d139e5646c086 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 10:08:20 -0400 Subject: [PATCH 3/9] Add a man page for the chardetect command --- chardetect.1 | 23 +++++++++++++++++++++++ python-chardet.spec | 4 ++++ 2 files changed, 27 insertions(+) create mode 100644 chardetect.1 diff --git a/chardetect.1 b/chardetect.1 new file mode 100644 index 0000000..31717c2 --- /dev/null +++ b/chardetect.1 @@ -0,0 +1,23 @@ +.TH CHARDETECT "1" "June 2022" "" "User Commands" +.SH NAME +.B chardetect +\(en takes one or more file paths and reports their detected encodings +.SH SYNOPSIS +.B chardetect +.RB [ \-h ] +.RB [ \-\-version ] +.RI [ input \ ...] +.SH OPTIONS +.SS "POSITIONAL ARGUMENTS" +.TP +.I input +File whose encoding we would like to determine. +(default: +.IR stdin ) +.SS "OPTIONAL ARGUMENTS" +.TP +.B \-h\fR, \fB\-\-help +show a help message and exit +.TP +.B \-\-version +show program\(cqs version number and exit diff --git a/python-chardet.spec b/python-chardet.spec index 68b209e..248cc39 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -15,6 +15,8 @@ Summary: Character encoding auto-detection in Python 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 @@ -59,6 +61,7 @@ grep -lr "^#\!/usr/bin/env python" chardet/ | xargs sed -i "1d" %install %pyproject_install %pyproject_save_files chardet +install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}' %if %{with tests} @@ -71,6 +74,7 @@ grep -lr "^#\!/usr/bin/env python" chardet/ | xargs sed -i "1d" %license LICENSE %doc README.rst %{_bindir}/chardetect +%{_mandir}/man1/chardetect.1* %changelog From d8cc36cf0bae3b3332eb8be072e7010be2cc160d Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 10:19:04 -0400 Subject: [PATCH 4/9] Update summary and description from upstream --- python-chardet.spec | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/python-chardet.spec b/python-chardet.spec index 248cc39..9db58cf 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -1,7 +1,7 @@ Name: python-chardet Version: 4.0.0 Release: %autorelease -Summary: Character encoding auto-detection in Python +Summary: Python character encoding detector # The entire source is LGPLv2+, except: # @@ -29,17 +29,35 @@ BuildRequires: pyproject-rpm-macros BuildRequires: python3-pytest %endif -%global _description\ -Character encoding auto-detection in Python. As\ -smart as your browser. Open source. +%global common_description %{expand: +Chardet: The Universal Character Encoding Detector -%description %_description +Detects: + + • ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants) + • Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified + Chinese) + • EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP (Japanese) + • EUC-KR, ISO-2022-KR, Johab (Korean) + • KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic) + • ISO-8859-5, windows-1251 (Bulgarian) + • ISO-8859-1, windows-1252 (Western European languages) + • ISO-8859-7, windows-1253 (Greek) + • ISO-8859-8, windows-1255 (Visual and Logical Hebrew) + • TIS-620 (Thai) + +ISO-8859-2 and windows-1250 (Hungarian) probers have been temporarily +disabled.} + +%description +%{common_description} %package -n python3-chardet Summary: %{summary} -%description -n python3-chardet %_description +%description -n python3-chardet +%{common_description} %prep From 97d0054fb44491d2ef7466273b5904418b9d18db Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 10:20:01 -0400 Subject: [PATCH 5/9] Drop explicit pyproject-rpm-macros BR --- python-chardet.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python-chardet.spec b/python-chardet.spec index 9db58cf..b584975 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -21,7 +21,6 @@ Source1: chardetect.1 BuildArch: noarch BuildRequires: python3-devel -BuildRequires: pyproject-rpm-macros # Circular dependency on pytest %bcond_without tests @@ -69,7 +68,7 @@ grep -lr "^#\!/usr/bin/env python" chardet/ | xargs sed -i "1d" %generate_buildrequires -%pyproject_buildrequires -r +%pyproject_buildrequires %build From d4143c12d288779911047a6bf1300984b7aef246 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 10:31:42 -0400 Subject: [PATCH 6/9] Package Sphinx-generated PDF in a -doc subpackage --- python-chardet.spec | 46 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/python-chardet.spec b/python-chardet.spec index b584975..4954a5b 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -1,3 +1,12 @@ +# Circular dependency on pytest +%bcond_without tests + +# 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: 4.0.0 Release: %autorelease @@ -22,12 +31,20 @@ BuildArch: noarch BuildRequires: python3-devel -# Circular dependency on pytest -%bcond_without tests %if %{with tests} BuildRequires: python3-pytest %endif +%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 @@ -59,6 +76,13 @@ Summary: %{summary} %{common_description} +%package doc +Summary: Documentation for python-chardet + +%description doc +%{common_description} + + %prep %autosetup -p1 -n chardet-%{version} @@ -66,6 +90,9 @@ Summary: %{summary} # 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 @@ -74,6 +101,11 @@ grep -lr "^#\!/usr/bin/env python" chardet/ | xargs sed -i "1d" %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 @@ -88,11 +120,17 @@ install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}' %files -n python3-chardet -f %{pyproject_files} -%license LICENSE -%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 From 08596830878b0d21adb682d8d564fdf278a6e8ef Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 10:56:55 -0400 Subject: [PATCH 7/9] BR python3dist(hypothesis) to enable more tests --- python-chardet.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python-chardet.spec b/python-chardet.spec index 4954a5b..56dc09d 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -32,7 +32,9 @@ BuildArch: noarch BuildRequires: python3-devel %if %{with tests} -BuildRequires: python3-pytest +BuildRequires: python3dist(pytest) +# Optional; enables additional tests (see test.py) +BuildRequires: python3dist(hypothesis) %endif %if %{with doc_pdf} From 500fd9ab06eb899c2361268af71252f68bc29eb9 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 12:53:26 -0400 Subject: [PATCH 8/9] Drop test data with problematic license status --- .gitignore | 1 + get_source | 34 ++++++++++++++++++++++++++++++++++ python-chardet.spec | 44 ++++++++++++++++++++++---------------------- sources | 2 +- 4 files changed, 58 insertions(+), 23 deletions(-) create mode 100755 get_source diff --git a/.gitignore b/.gitignore index bb18b7a..4a4974b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /chardet-*.tar.gz /chardet-*/ +/chardet-4.0.0-filtered.tar.xz diff --git a/get_source b/get_source new file mode 100755 index 0000000..8268d9e --- /dev/null +++ b/get_source @@ -0,0 +1,34 @@ +#!/bin/sh +set -o errexit +set -o nounset + +if [ "$#" != '1' ] +then + cat 1>&2 < Downloading: ${URL}" 1>&2 +curl -L -O "${URL}" + +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 +rm -rvf */tests/ +FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.xz" +echo "--> Re-archiving: ${FILTERED}" 1>&2 +tar -c "${FILTERED}" */ | xz -9e > "${FILTERED}" +mv -v "${FILTERED}.xz" "${OUTDIR}" +echo 'Done.' 1>&2 diff --git a/python-chardet.spec b/python-chardet.spec index 56dc09d..2e38257 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -1,6 +1,3 @@ -# Circular dependency on pytest -%bcond_without tests - # Sphinx-generated HTML documentation is not suitable for packaging; see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. # @@ -12,31 +9,34 @@ Version: 4.0.0 Release: %autorelease Summary: Python character encoding detector -# The entire source is LGPLv2+, except: -# -# - tests/ascii/howto.diveintomark.org.xml is CC-BY-SA (but is not installed) +# 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 +# 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} +# A filtered source tarball, obtained by (see Source1): +# +# ./get_source %%{version} +# +# is required because the contents of tests/ are under various undocumented +# licenses and are, for the most part, not freely redistributable. See: +# +# problematic licensing of /tests? +# https://github.com/chardet/chardet/issues/231 +Source0: chardet-%{version}-filtered.tar.xz +Source1: get_source # Hand-written for Fedora in groff_man(7) format based on --help output -Source1: chardetect.1 +Source2: chardetect.1 BuildArch: noarch BuildRequires: python3-devel -%if %{with tests} -BuildRequires: python3dist(pytest) -# Optional; enables additional tests (see test.py) -BuildRequires: python3dist(hypothesis) -%endif - %if %{with doc_pdf} BuildRequires: make BuildRequires: python3dist(sphinx) @@ -112,13 +112,13 @@ PYTHONPATH="${PWD}" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}' %install %pyproject_install %pyproject_save_files chardet -install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}' +install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE2}' -%if %{with tests} %check -%pytest -v -%endif +# 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} diff --git a/sources b/sources index dad62a1..f73c80e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (chardet-4.0.0.tar.gz) = ebd7f420e1094445270db993f6373ffe7370419e002b0bb13299dc6c9b0f7c4e77b0f44f871fba6371e6869e7c86728514367db377e3137487a3acf50cb81e96 +SHA512 (chardet-4.0.0-filtered.tar.xz) = ac510d460dc65233bda8d11964d6d9a130a53ef64035393d05c52ab6c4e0b7a7ca6f34108c21771fb40236d71e7de62dfe6c6f9fa6cd1722a355116930b5e12b From 2652ef7c5328685175119dac1c80a64845d5a290 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 12:59:37 -0400 Subject: [PATCH 9/9] Fix get_source_script --- get_source | 2 +- sources | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/get_source b/get_source index 8268d9e..513d1d3 100755 --- a/get_source +++ b/get_source @@ -30,5 +30,5 @@ rm -rvf */tests/ FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.xz" echo "--> Re-archiving: ${FILTERED}" 1>&2 tar -c "${FILTERED}" */ | xz -9e > "${FILTERED}" -mv -v "${FILTERED}.xz" "${OUTDIR}" +mv -v "${FILTERED}" "${OUTDIR}" echo 'Done.' 1>&2 diff --git a/sources b/sources index f73c80e..dc7d2f5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (chardet-4.0.0-filtered.tar.xz) = ac510d460dc65233bda8d11964d6d9a130a53ef64035393d05c52ab6c4e0b7a7ca6f34108c21771fb40236d71e7de62dfe6c6f9fa6cd1722a355116930b5e12b +SHA512 (chardet-4.0.0-filtered.tar.xz) = 4c41d5f9311e6796a3270b5ecd63abc51e52962c97a7599e8756e82ba97998306e2e841e14da96441a63c446fa9142534bac7154579822b55882e621f3bbe2e0