%global srcname docx # Currently, python3-behave is not packaged for EPEL8. %bcond_with behave3 # 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 lesser substitute. %bcond_without doc_pdf Name: python-%{srcname} Version: 0.8.11 Release: 3%{?dist} Summary: Create and modify Word documents with Python License: MIT URL: https://%{name}.readthedocs.io/en/latest/ # We MUST use the PyPI tarball; the GitHub tarball includes material under ref/ # (PDFs of ISO/IEC standards) for which redistribution may be prohibited. Source0: %{pypi_source %{name}} BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools # setup.py install_requires: BuildRequires: python-lxml >= 2.3.2 BuildRequires: python%{python3_pkgversion}-lxml >= 2.3.2 # tox.ini: BuildRequires: python2-behave BuildRequires: pyparsing BuildRequires: python2-pytest BuildRequires: python2-mock %if %{with behave3} BuildRequires: python%{python3_pkgversion}-behave %endif BuildRequires: python%{python3_pkgversion}-pyparsing BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: dos2unix # Extra dependencies for documentation %if %{with doc_pdf} BuildRequires: make BuildRequires: python2-sphinx BuildRequires: python2-docs BuildRequires: latexmk # No python2-sphinx-latex on EPEL7; list dependencies manually. This list may # not be strictly minimal, but it is sufficient. BuildRequires: texlive-collection-fontsrecommended BuildRequires: texlive-collection-latex BuildRequires: texlive-dvipng BuildRequires: tex(amsmath.sty) BuildRequires: tex(amsthm.sty) BuildRequires: tex(article.cls) BuildRequires: tex(cmap.sty) BuildRequires: tex(color.sty) BuildRequires: tex(ecrm1000.tfm) BuildRequires: tex(fancybox.sty) BuildRequires: tex(fancyhdr.sty) BuildRequires: tex(fancyvrb.sty) BuildRequires: tex(fncychap.sty) BuildRequires: tex(footnote.sty) BuildRequires: tex(framed.sty) BuildRequires: tex(geometry.sty) BuildRequires: tex(hyperref.sty) BuildRequires: tex(kvoptions.sty) BuildRequires: tex(multirow.sty) BuildRequires: tex(parskip.sty) BuildRequires: tex(polyglossia.sty) BuildRequires: tex(threeparttable.sty) BuildRequires: tex(titlesec.sty) BuildRequires: tex(upquote.sty) BuildRequires: tex(utf8x.def) BuildRequires: tex(wrapfig.sty) %endif %global common_description %{expand: A Python library for creating and updating Microsoft Word (.docx) files.} %description %{common_description} %package -n python2-%{srcname} Summary: %{summary} %{?python_provide:%python_provide python2-%{srcname}} # setup.py install_requires: Requires: python-lxml >= 2.3.2 %description -n python2-%{srcname} %{common_description} %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} # setup.py install_requires: Requires: python%{python3_pkgversion}-lxml >= 2.3.2 %description -n python%{python3_pkgversion}-%{srcname} %{common_description} %package doc Summary: Documentation for %{name} Requires: python2-docs %description doc %{common_description} %prep %autosetup # We don’t want to package https://github.com/armstrong/armstrong_sphinx (and # shouldn’t use the bundled copy), so we just switch the documentation theme # from “armstrong” to the built-in “default”. The result seems similarly # useful, without the bundling. rm -rf docs/_themes sed -r -i 's@armstrong@default@' docs/conf.py # Use local inventories in intersphinx mappings. sed -r -i "s@https?://docs.python.org/3?@/%{_docdir}/python-docs-$( %{__python2} -c 'import sys; print "%d.%d.%d" % sys.version_info[:3]' )/html@" docs/conf.py # Fix a stray CRLF-terminated reStructuredText file: dos2unix docs/dev/analysis/features/table/cell-merge.rst %build %py3_build %py2_build %if %{with doc_pdf} %make_build -C docs latex %make_build -C docs/.build/latex %endif %install %py3_install %py2_install %check export PYTHONDONTWRITEBYTECODE='1' export PYTHONPATH='%{buildroot}%{python2_sitelib}' %{__python2} -m pytest %{__python2} -m behave --format progress --stop --tags=-wip export PYTHONPATH='%{buildroot}%{python3_sitelib}' %{__python3} -m pytest %if %{with behave} %{__python3} -m behave --format progress --stop --tags=-wip %endif # Fail the build if the tarball accidentally included ISO/IEC standards # documents that should not have been redistributed. Note that removing these # in %%prep would not have been good enough. banned="$(find . -type f -name 'ISO*.pdf')" if [ -n "${banned}" ] then cat < - 0.8.11-3 - Generate PDF instead of HTML Sphinx documentation * Tue Aug 10 2021 Benjamin A. Beasley - 0.8.11-2 - Use the PyPI tarball to avoid redistributing ISO standard PDFs * Fri Aug 06 2021 Benjamin A. Beasley - 0.8.11-1 - Initial package for EPEL7