# # spec file # # Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %if 0%{?suse_version} > 1500 %bcond_with libalternatives %else %bcond_with libalternatives %endif %global flavor %{nil} %if "%{flavor}" == "test" %define psuffix -test %bcond_without test %else %define psuffix %{nil} %bcond_with test %endif %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 %define skip_python36 1 %{?sle15_python_module_pythons} Name: python-chardet%{psuffix} Version: 5.2.0 Release: 1.9 Summary: Universal encoding detector License: LGPL-2.1-or-later URL: https://github.com/chardet/chardet Source0: https://files.pythonhosted.org/packages/source/c/chardet/chardet-%{version}.tar.gz BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros >= 20210929 %if %{with libalternatives} BuildRequires: alts Requires: alts %else Requires(post): update-alternatives Requires(postun):update-alternatives %endif BuildArch: noarch %if %{with test} BuildRequires: %{python_module hypothesis} BuildRequires: %{python_module pytest} %endif %python_subpackages %description Universal character encoding detector ------------------------------------- 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, ISO-2022-JP (Japanese) - EUC-KR, ISO-2022-KR (Korean) - KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic) - ISO-8859-2, windows-1250 (Hungarian) - ISO-8859-5, windows-1251 (Bulgarian) - windows-1252 (English) - ISO-8859-7, windows-1253 (Greek) - ISO-8859-8, windows-1255 (Visual and Logical Hebrew) - TIS-620 (Thai) Requires Python 2.1 or later Command-line Tool ----------------- chardet comes with a command-line script which reports on the encodings of one or more files:: % chardetect.py somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 %prep %setup -q -n chardet-%{version} sed -i '1{/^#!/d}' chardet/lang*model.py chardet/metadata/languages.py %build %pyproject_wheel %install %if !%{with test} %pyproject_install %python_clone -a %{buildroot}%{_bindir}/chardetect %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif %check %if %{with test} # https://github.com/chardet/chardet/issues/256 donttest="test_detect_all_and_detect_one_should_agree" %pytest -k "not $donttest" %endif %if !%{with test} %pre # If libalternatives is used: Removing old update-alternatives entries. %python_libalternatives_reset_alternative chardetect %post %python_install_alternative chardetect %postun %python_uninstall_alternative chardetect %files %{python_files} %doc README.rst %python_alternative %{_bindir}/chardetect %{python_sitelib}/chardet %{python_sitelib}/chardet-%{version}*-info %endif %changelog * Mon Sep 4 2023 Dirk Müller - update to 5.2.0: * Adds support for running chardet CLI via `python -m chardet` * Fri Apr 21 2023 Dirk Müller - add sle15_python_module_pythons (jsc#PED-68) * Thu Apr 13 2023 Matej Cepl - Make calling of %%{sle15modernpython} optional. * Mon Jan 16 2023 Dirk Müller - skip python 3.6 builds * Mon Jan 2 2023 Dirk Müller - update to 5.1.0: * Add should_rename_legacy argument to most functions, which will rename older encodings to their more modern equivalents (e.g., GB2312 becomes GB18030) (#264, @dan-blanchard) * Add capital letter sharp S and ISO-8859-15 support * Add a prober for MacRoman encoding * Add --minimal flag to chardetect command * Add type annotations to the project and run mypy on CI * Add support for Python 3.11 * Clarify LGPL version in License trove classifier (#255, @musicinmybrain) * Remove support for EOL Python 3.6 (#260, @jdufresne) * Remove unnecessary guards for non-falsey values (#259, @jdufresne) * Switch to Python 3.10 release in GitHub actions (#257, @jdufresne) * Remove setup.py in favor of build package (#262, @jdufresne) * Run tests on macos, Windows, and 3.11-dev (#267, @dan-blanchard) * Tue Jul 5 2022 Ben Greiner - Update to 5.0.0 * This release is the first release of chardet that no longer supports Python < 3.6 * Added a prober for Johab Korean (#207, @grizlupo) * Added a prober for UTF-16/32 BE/LE (#109, #206, @jpz) * Added test data for Croatian, Czech, Hungarian, Polish, Slovak, Slovene, Greek, and Turkish, which should help prevent future errors with those languages * Improved XML tag filtering, which should improve accuracy for XML files (#208) * Tweaked SingleByteCharSetProber confidence to match latest uchardet (#209) * Made detect_all return child prober confidences (#210) * Updated examples in docs (#223, @domdfcoding) * Documentation fixes (#212, #224, #225, #226, #220, #221, #244 from too many to mention) * Minor performance improvements (#252, @deedy5) * Add support for Python 3.10 when testing (#232, @jdufresne) * Lots of little development cycle improvements, mostly thanks to @jdufresne - Canonicalize alternatives creation * Fri Dec 10 2021 pgajdos@suse.com - pytest-runner is not required for build * Thu Sep 30 2021 Stefan Schubert - Use libalternatives instead of update-alternatives. * Sun Dec 20 2020 John Vandenberg - Remove now unnecessary pytest4.patch and python-chardet-rpmlintrc - Update to v4.0.0 See https://github.com/chardet/chardet/compare/3.0.4...4.0.0 * Mon Oct 14 2019 Matej Cepl - Replace %%fdupes -s with plain %%fdupes; hardlinks are better. * Wed Jul 3 2019 Tomáš Chvátal - Add patch to fix build with pytest4: * pytest4.patch * Tue Feb 26 2019 Tomáš Chvátal - Switch to multibuild to avoid buildcycles * Tue Dec 4 2018 Matej Cepl - Remove superfluous devel dependency for noarch package * Tue May 15 2018 antoine.belvire@opensuse.org - Fix update-alternatives call in %%postun. * Wed Sep 20 2017 dmueller@suse.com - add update-alternatives post-requires * Fri Aug 25 2017 tbechtold@suse.com - Fix build for Leap-42.3 * Tue Aug 15 2017 dmueller@suse.com - add update-alternative support for py2/py3 coinstallability * Thu Jun 29 2017 ecsos@opensuse.org - fix source link * Sat Jun 10 2017 dmueller@suse.com - update to 3.0.4 * Tue Mar 21 2017 jmatejek@suse.com - do not use %%py_ver, replace with %%python_version * Sun Mar 19 2017 aloisio@gmx.com - Converted to single spec. * Mon Jan 30 2017 rjschwei@suse.com - Include in SLE 12 (bsc#1002895, FATE#321630) * Mon May 11 2015 arun@gmx.de - specfile: * added update alternative to prevent conflicts with python3 version * add tests * Tue Feb 10 2015 aloisio@gmx.com - Update to version 2.3.0 * Added support for CP932 detection (thanks to @hashy) * Fixed an issue where UTF-8 with a BOM would not be detected as UTF-8-SIG (#8) * Modified chardetect to use argparse for argument parsing * Moved docs to a gh-pages branch. You can now access them at http://chardet.github.io - Changelog on https://github.com/chardet/chardet/commits/2.3.0 - Other minor changes * Thu Oct 24 2013 speilicke@suse.com - Require python-setuptools instead of distribute (upstreams merged) * Tue Oct 2 2012 alexandre@exatati.com.br - Update to 2.1.1: - Sorry, no changelog. * Fri Jul 27 2012 alexandre@exatati.com.br - Update to 1.1: - Sorry, no changelog. * Wed Dec 28 2011 alexandre@exatati.com.br - Standard in spec file; - Remove CFLAGS and %%clean section from spec file. * Thu Dec 8 2011 coolo@suse.com - the license seems to be LGPL-2.1+ * Sat Mar 26 2011 alexandre@exatati.com.br - Regenerate spec file with py2pack; - Bzip2 source file. * Mon Jan 25 2010 alexandre@exatati.com.br - Initial package (2.0.1) for openSUSE.