Package Sphinx-generated PDF in a -doc subpackage
This commit is contained in:
parent
e537507a1b
commit
404157ecdc
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user