b354d33
# Enabled by default
b354d33
# If the package needs to download data for the test which cannot be done in
b354d33
# koji, these can be disabled in koji by using `bcond_with` instead, but the
b354d33
# tests must be validated in mock with network enabled like so:
b354d33
# mock -r fedora-rawhide-x86_64 rebuild <srpm> --enable-network --rpmbuild-opts="--with tests"
b354d33
%bcond_without tests
b354d33
b354d33
# Enabled by default
b354d33
%bcond_without docs
b354d33
b354d33
%global pypi_name pylatex
b354d33
%global fancy_name PyLaTeX
b354d33
b354d33
%global _description %{expand:
b354d33
PyLaTeX is a Python library for creating and compiling LaTeX files or snippets.
b354d33
The goal of this library is being an easy but extensible interface between
b354d33
Python and LaTeX.}
b354d33
b354d33
Name:           python-%{pypi_name}
36e1368
Version:        1.3.1
36e1368
Release:        1%{?dist}
b354d33
Summary:        Library for creating LaTeX files and snippets
b354d33
b354d33
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
b354d33
License:        MIT
b354d33
URL:            https://jeltef.github.io/PyLaTeX/
b354d33
Source0:        https://github.com/JelteF/%{fancy_name}/archive/v%{version}/%{name}-%{version}.tar.gz
b354d33
BuildArch:      noarch
b354d33
b354d33
%description %_description
b354d33
b354d33
%{?python_enable_dependency_generator}
b354d33
b354d33
%package -n python3-%{pypi_name}
b354d33
Summary:        %{summary}
b354d33
# Not picked up by dep generator
b354d33
Requires:       %{py3_dist matplotlib}
b354d33
Requires:       %{py3_dist quantities}
b354d33
Requires:       %{py3_dist numpy}
b354d33
# Will also pull a lot of texlive, but that cannot be helpeb
b354d33
Requires:       /usr/bin/latexmk
b354d33
Requires:       /usr/bin/pdflatex
b354d33
# From `ag Package`
b354d33
Requires:       tex(alltt.sty)
b354d33
Requires:       tex(amsmath.sty)
b354d33
Requires:       tex(booktabs.sty)
b354d33
Requires:       tex(cleveref.sty)
b354d33
Requires:       tex(enumitem.sty)
b354d33
Requires:       tex(fontenc.sty)
b354d33
Requires:       tex(fancyhdr.sty)
b354d33
Requires:       tex(geometry.sty)
b354d33
Requires:       tex(graphicx.sty)
b354d33
Requires:       tex(hyperref.sty)
b354d33
Requires:       tex(inputenc.sty)
b354d33
Requires:       tex(lmodern.sty)
b354d33
Requires:       tex(lastpage.sty)
b354d33
Requires:       tex(longtable.sty)
b354d33
Requires:       tex(ltablex.sty)
b354d33
Requires:       tex(mdframed.sty)
b354d33
Requires:       tex(microtype.sty)
b354d33
Requires:       tex(multirow.sty)
b354d33
Requires:       tex(parskip.sty)
b354d33
Requires:       tex(pgfplots.sty)
b354d33
Requires:       tex(ragged2e.sty)
b354d33
Requires:       tex(subcaption.sty)
b354d33
Requires:       tex(siunitx.sty)
b354d33
Requires:       tex(tabularx.sty)
b354d33
Requires:       tex(tabu.sty)
b354d33
Requires:       tex(textcomp.sty)
b354d33
Requires:       tex(textpos.sty)
b354d33
Requires:       tex(tikz.sty)
b354d33
Requires:       tex(xcolor.sty)
b354d33
Requires:       texlive
b354d33
b354d33
BuildRequires:  python3-devel
b354d33
%if %{with tests}
b354d33
# Explicit requirements for tests
b354d33
BuildRequires:  %{py3_dist matplotlib}
b354d33
BuildRequires:  %{py3_dist nose}
b354d33
BuildRequires:  %{py3_dist numpy}
b354d33
BuildRequires:  %{py3_dist quantities}
b354d33
# https://fedoraproject.org/wiki/Features/TeXLive
b354d33
BuildRequires:  tex(alltt.sty)
b354d33
BuildRequires:  tex(amsmath.sty)
b354d33
BuildRequires:  tex(booktabs.sty)
b354d33
BuildRequires:  tex(cleveref.sty)
b354d33
BuildRequires:  tex(enumitem.sty)
b354d33
BuildRequires:  tex(fontenc.sty)
b354d33
BuildRequires:  tex(fancyhdr.sty)
b354d33
BuildRequires:  tex(geometry.sty)
b354d33
BuildRequires:  tex(graphicx.sty)
b354d33
BuildRequires:  tex(hyperref.sty)
b354d33
BuildRequires:  tex(inputenc.sty)
b354d33
BuildRequires:  tex(lmodern.sty)
b354d33
BuildRequires:  tex(lastpage.sty)
b354d33
BuildRequires:  tex(longtable.sty)
b354d33
BuildRequires:  tex(ltablex.sty)
b354d33
BuildRequires:  tex(mdframed.sty)
b354d33
BuildRequires:  tex(microtype.sty)
b354d33
BuildRequires:  tex(multirow.sty)
b354d33
BuildRequires:  tex(parskip.sty)
b354d33
BuildRequires:  tex(pgfplots.sty)
b354d33
BuildRequires:  tex(ragged2e.sty)
b354d33
BuildRequires:  tex(subcaption.sty)
b354d33
BuildRequires:  tex(siunitx.sty)
b354d33
BuildRequires:  tex(tabularx.sty)
b354d33
BuildRequires:  tex(tabu.sty)
b354d33
BuildRequires:  tex(textcomp.sty)
b354d33
BuildRequires:  tex(textpos.sty)
b354d33
BuildRequires:  tex(tikz.sty)
b354d33
BuildRequires:  tex(xcolor.sty)
b354d33
BuildRequires:  texlive
b354d33
%endif
b354d33
b354d33
%{?python_provide:%python_provide python3-%{pypi_name}}
b354d33
b354d33
%description -n python3-%{pypi_name} %_description
b354d33
b354d33
%if %{with docs}
b354d33
%package doc
b354d33
Summary:        %{summary}
b354d33
BuildRequires:  %{py3_dist sphinx}
b354d33
BuildRequires:  %{py3_dist ordered-set}
b354d33
BuildRequires:  %{py3_dist sphinx_rtd_theme}
b354d33
b354d33
%description doc
b354d33
Documentation for %{name}.
b354d33
%endif
b354d33
b354d33
%prep
b354d33
%autosetup -n %{fancy_name}-%{version}
b354d33
rm -rf %{fancy_name}.egg-info
b354d33
b354d33
# Comment out to remove /usr/bin/env shebangs
b354d33
# Can use something similar to correct/remove /usr/bin/python shebangs also
b354d33
# find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'
b354d33
b354d33
%build
b354d33
%py3_build
b354d33
b354d33
make -C docs SPHINXBUILD=sphinx-build-3 html
b354d33
pushd docs/build/html
b354d33
    # Remove unneeded dot files
b354d33
    rm -frv .doctrees
b354d33
    rm -frv .buildinfo
b354d33
    # Correct end of line
b354d33
    sed -i 's/\r$//' _static/favicons/browserconfig.xml
b354d33
    # convert to utf8
b354d33
    iconv -f iso8859-1 -t utf-8 objects.inv > objects.inv.conv && mv -f objects.inv.conv objects.inv
b354d33
    sed -i 's/\r$//' objects.inv
b354d33
popd
b354d33
b354d33
%install
b354d33
%py3_install
b354d33
b354d33
b354d33
%check
b354d33
%if %{with tests}
b354d33
# Run tests
b354d33
nosetests-3 tests/*
b354d33
b354d33
# Test examples
b354d33
pushd examples
b354d33
for f in *.py; do
b354d33
    PYTHONPATH=%{buildroot}/%{python3_sitelib} %{__python3} $f
b354d33
done
b354d33
popd
b354d33
%endif
b354d33
b354d33
%files -n python3-%{pypi_name}
b354d33
%license LICENSE
b354d33
%doc README.rst
b354d33
%{python3_sitelib}/%{fancy_name}-%{version}-py3.?.egg-info
b354d33
%{python3_sitelib}/%{pypi_name}
b354d33
b354d33
%if %{with docs}
b354d33
%files doc
b354d33
%license LICENSE
b354d33
%doc docs/build/html examples
b354d33
%endif
b354d33
b354d33
%changelog
36e1368
* Thu Oct 10 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.3.1-1
36e1368
- Update to 1.3.1
36e1368
9d8be65
* Mon Aug 19 2019 Miro HronĨok <mhroncok@redhat.com> - 1.3.0-3
9d8be65
- Rebuilt for Python 3.8
9d8be65
f937fb9
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-2
f937fb9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
f937fb9
b354d33
* Tue Jun 18 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.3.0-1
b354d33
- Minor tweaks as per review comments
b354d33
- https://bugzilla.redhat.com/show_bug.cgi?id=1721409
b354d33
- Improve description macro
b354d33
b354d33
* Mon Jun 17 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.3.0-1
b354d33
- Initial rpm build