From bb02f9bf86f82c4a2b11f70945acd70db0b53e48 Mon Sep 17 00:00:00 2001 From: Mateusz Korniak Date: Mon, 23 May 2016 09:41:03 +0200 Subject: [PATCH] Version 0.1a4. Recent python template used. --- python-xhtml2pdf.spec | 120 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 99 insertions(+), 21 deletions(-) diff --git a/python-xhtml2pdf.spec b/python-xhtml2pdf.spec index 3700e84..7284d09 100644 --- a/python-xhtml2pdf.spec +++ b/python-xhtml2pdf.spec @@ -1,51 +1,113 @@ -# -# Conditional build: -%bcond_without tests # do not perform "make test" +# TODO: Fix tests +# TODO: Fix dependencies for Python 3.x version +%bcond_with doc # don't build doc +%bcond_with tests # do not perform "make test" +%bcond_without python2 # CPython 2.x module +%bcond_with python3 # CPython 3.x module %define module xhtml2pdf Summary: PDF generator using HTML and CSS +Summary(pl.UTF-8): Generator PDF używający HTML i CSS Name: python-%{module} -Version: 0.0.3 -Release: 0.1 -License: Apache License 2.0 -Group: Development/Languages/Python -Source0: http://pypi.python.org/packages/source/x/xhtml2pdf/%{module}-%{version}.tar.gz -# Source0-md5: 13b0d6059b72c994473fddfa7a528451 -URL: http://pypi.python.org/pypi/xhtml2pdf/ +Version: 0.1a4 +Release: 1 +License: Apache v2.0 +Group: Libraries/Python +Source0: https://pypi.python.org/packages/1c/04/a52a262a9ae6cd07b86baf2d9486d00da1dec5edf638cbe19c5983ebd266/xhtml2pdf-%{version}.tar.gz +# Source0-md5: beb2d99bb99376a3a4f584599eacec23 +URL: https://pypi.python.org/pypi/xhtml2pdf/ +BuildRequires: rpm-pythonprov +BuildRequires: rpmbuild(macros) >= 1.714 +%if %{with python2} +BuildRequires: python-PyPDF2 BuildRequires: python-ReportLab >= 2.2 BuildRequires: python-distribute BuildRequires: python-html5lib >= 0.11.1 -BuildRequires: python-pyPdf >= 1.11 +BuildRequires: python-modules +BuildRequires: python-pillow BuildRequires: rpm-pythonprov -# if py_postclean is used -BuildRequires: rpmbuild(macros) >= 1.710 +%endif +%if %{with python3} +BuildRequires: python3-PyPDF2 +BuildRequires: python3-ReportLab >= 2.2 +BuildRequires: python3-distribute +BuildRequires: python3-html5lib >= 0.11.1 +BuildRequires: python3-modules +BuildRequires: python3-pillow +%endif Requires: python-modules +Obsoletes: python-pisa BuildArch: noarch BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description -HTML/CSS to PDF converter based on Python. +html2pdf converter using the ReportLab Toolkit, the HTML5lib and +pyPdf. + +%description -l pl.UTF-8 +Konwertor html2pdf używający narzędzi ReportLab, HTML5lib i pyPdf. + +%package -n python3-%{module} +Summary: PDF generator using HTML and CSS +Summary(pl.UTF-8): Generator PDF używający HTML i CSS +Group: Libraries/Python +BuildRequires: python3-pillow +Requires: python3-modules + +%description -n python3-%{module} +html2pdf converter using the ReportLab Toolkit, the HTML5lib and +pyPdf. + +%description -n python3-%{module} -l pl.UTF-8 +Konwertor html2pdf używający narzędzi ReportLab, HTML5lib i pyPdf. + +%package apidocs +Summary: %{module} API documentation +Summary(pl.UTF-8): Dokumentacja API %{module} +Group: Documentation + +%description apidocs +API documentation for %{module}. + +%description apidocs -l pl.UTF-8 +Dokumentacja API %{module}. %prep %setup -q -n %{module}-%{version} - %build -%py_build +%if %{with python2} +%py_build %{?with_tests:test} +%endif + +%if %{with python3} +%py3_build %{?with_tests:test} +%endif -%{?with_tests:%{__python} setup.py test} +%if %{with doc} +cd docs +%{__make} -j1 html +rm -rf _build/html/_sources +%endif %install rm -rf $RPM_BUILD_ROOT -%py_install -%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} -%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} +%if %{with python2} +%py_install +%py_ocomp $RPM_BUILD_ROOT%{py_sitedir} +%py_comp $RPM_BUILD_ROOT%{py_sitedir} %py_postclean +%endif + +%if %{with python3} +%py3_install +%endif %clean rm -rf $RPM_BUILD_ROOT +%if %{with python2} %files %defattr(644,root,root,755) %doc README.rst @@ -54,6 +116,22 @@ rm -rf $RPM_BUILD_ROOT %{py_sitescriptdir}/%{module}/*.py[co] %dir %{py_sitescriptdir}/%{module}/w3c %{py_sitescriptdir}/%{module}/w3c/*.py[co] + %if "%{py_ver}" > "2.4" -%{py_sitescriptdir}/%{module}-*.egg-info +%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info +%endif +%endif + +%if %{with python3} +%files -n python3-%{module} +%defattr(644,root,root,755) +%doc README.rst +# TODO: files +%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info +%endif + +%if %{with doc} +%files apidocs +%defattr(644,root,root,755) +%doc docs/_build/html/* %endif -- 2.44.0