# 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 doc 0 %global python3_pkgversion 3.11 Name: python-chardet Version: 5.2.0 Release: 4.ac%{?dist} 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 URL: https://github.com/chardet/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: https://files.pythonhosted.org/packages/f3/0d/f7b6ab21ec75897ed80c17d79b15951a719226b9fababf1e40ea74d69079/chardet-%{version}.tar.gz Source1: get_source # Hand-written for Fedora in groff_man(7) format based on --help output Source2: chardetect.1 BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel %if %{with doc} BuildRequires: make BuildRequires: python%{python3_pkgversion}dist(sphinx) BuildRequires: python%{python3_pkgversion}dist(sphinx-rtd-theme) BuildRequires: python%{python3_pkgversion}-sphinx-latex BuildRequires: latexmk BuildRequires: tex-xetex-bin BuildRequires: /usr/bin/xindy %endif %global common_description %{expand: Chardet: The 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, 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 python%{python3_pkgversion}-chardet Summary: %{summary} %description -n python%{python3_pkgversion}-chardet %{common_description} %package doc Summary: Documentation for python-chardet %description doc %{common_description} %prep %autosetup -n chardet-%{version} # 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} PYTHONPATH="${PWD}" %make_build -C docs latex \ SPHINXOPTS='-j%{?_smp_build_ncpus}' %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}' for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s/(.*)$/\1%{python3_pkgversion}/"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s/(.*).([1-8]([^.]+)?)$/\1%{python3_pkgversion}.\2/"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s/(.*).mo$/\1%{python3_pkgversion}.mo/"<<<"$m"); done %check # We cannot run the upstream tests because they would require data files with # problematic license status. %pyproject_check_import %files -n python%{python3_pkgversion}-chardet -f %{pyproject_files} %if %{without doc} %doc README.rst %endif %{_bindir}/chardetect%{python3_pkgversion} %{_mandir}/man1/chardetect%{python3_pkgversion}.1* %if %{with doc} %files doc %license LICENSE %doc README.rst %doc docs/_build/latex/chardet.pdf %endif %changelog * Thu Mar 21 2024 Ding-Yi Chen - 5.2.0-4.ac - Bruteforce packaging