]>
Commit | Line | Data |
---|---|---|
bb02f9bf MK |
1 | # TODO: Fix tests |
2 | # TODO: Fix dependencies for Python 3.x version | |
3 | %bcond_with doc # don't build doc | |
4 | %bcond_with tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_with python3 # CPython 3.x module | |
28152574 | 7 | |
8 | %define module xhtml2pdf | |
9 | Summary: PDF generator using HTML and CSS | |
bb02f9bf | 10 | Summary(pl.UTF-8): Generator PDF używający HTML i CSS |
28152574 | 11 | Name: python-%{module} |
bb02f9bf | 12 | Version: 0.1a4 |
38dd1869 | 13 | Release: 4 |
bb02f9bf MK |
14 | License: Apache v2.0 |
15 | Group: Libraries/Python | |
16 | Source0: https://pypi.python.org/packages/1c/04/a52a262a9ae6cd07b86baf2d9486d00da1dec5edf638cbe19c5983ebd266/xhtml2pdf-%{version}.tar.gz | |
17 | # Source0-md5: beb2d99bb99376a3a4f584599eacec23 | |
18 | URL: https://pypi.python.org/pypi/xhtml2pdf/ | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-PyPDF2 | |
28152574 | 23 | BuildRequires: python-ReportLab >= 2.2 |
24 | BuildRequires: python-distribute | |
25 | BuildRequires: python-html5lib >= 0.11.1 | |
bb02f9bf MK |
26 | BuildRequires: python-modules |
27 | BuildRequires: python-pillow | |
bb02f9bf | 28 | %endif |
44355c76 | 29 | BuildRequires: rpm-pythonprov |
bb02f9bf MK |
30 | %if %{with python3} |
31 | BuildRequires: python3-PyPDF2 | |
32 | BuildRequires: python3-ReportLab >= 2.2 | |
bb02f9bf MK |
33 | BuildRequires: python3-html5lib >= 0.11.1 |
34 | BuildRequires: python3-modules | |
35 | BuildRequires: python3-pillow | |
36 | %endif | |
28152574 | 37 | Requires: python-modules |
82f842a1 MK |
38 | # /usr/bin/xhtml2pdf needs python-setuptools |
39 | Requires: python-setuptools | |
bb02f9bf | 40 | Obsoletes: python-pisa |
28152574 | 41 | BuildArch: noarch |
42 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
43 | ||
44 | %description | |
bb02f9bf MK |
45 | html2pdf converter using the ReportLab Toolkit, the HTML5lib and |
46 | pyPdf. | |
47 | ||
48 | %description -l pl.UTF-8 | |
49 | Konwertor html2pdf używający narzędzi ReportLab, HTML5lib i pyPdf. | |
50 | ||
51 | %package -n python3-%{module} | |
52 | Summary: PDF generator using HTML and CSS | |
53 | Summary(pl.UTF-8): Generator PDF używający HTML i CSS | |
54 | Group: Libraries/Python | |
bb02f9bf | 55 | Requires: python3-modules |
44355c76 | 56 | Requires: python3-pillow |
82f842a1 | 57 | Requires: python3-setuptools |
bb02f9bf MK |
58 | |
59 | %description -n python3-%{module} | |
60 | html2pdf converter using the ReportLab Toolkit, the HTML5lib and | |
61 | pyPdf. | |
62 | ||
63 | %description -n python3-%{module} -l pl.UTF-8 | |
64 | Konwertor html2pdf używający narzędzi ReportLab, HTML5lib i pyPdf. | |
65 | ||
66 | %package apidocs | |
67 | Summary: %{module} API documentation | |
68 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
69 | Group: Documentation | |
70 | ||
71 | %description apidocs | |
72 | API documentation for %{module}. | |
73 | ||
74 | %description apidocs -l pl.UTF-8 | |
75 | Dokumentacja API %{module}. | |
28152574 | 76 | |
77 | %prep | |
78 | %setup -q -n %{module}-%{version} | |
79 | ||
28152574 | 80 | %build |
bb02f9bf MK |
81 | %if %{with python2} |
82 | %py_build %{?with_tests:test} | |
83 | %endif | |
84 | ||
85 | %if %{with python3} | |
86 | %py3_build %{?with_tests:test} | |
87 | %endif | |
28152574 | 88 | |
bb02f9bf MK |
89 | %if %{with doc} |
90 | cd docs | |
91 | %{__make} -j1 html | |
92 | rm -rf _build/html/_sources | |
93 | %endif | |
28152574 | 94 | |
95 | %install | |
96 | rm -rf $RPM_BUILD_ROOT | |
28152574 | 97 | |
bb02f9bf MK |
98 | %if %{with python2} |
99 | %py_install | |
100 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
101 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
28152574 | 102 | %py_postclean |
bb02f9bf MK |
103 | %endif |
104 | ||
105 | %if %{with python3} | |
106 | %py3_install | |
107 | %endif | |
28152574 | 108 | |
109 | %clean | |
110 | rm -rf $RPM_BUILD_ROOT | |
111 | ||
bb02f9bf | 112 | %if %{with python2} |
28152574 | 113 | %files |
114 | %defattr(644,root,root,755) | |
115 | %doc README.rst | |
116 | %attr(755,root,root) %{_bindir}/* | |
117 | %dir %{py_sitescriptdir}/%{module} | |
118 | %{py_sitescriptdir}/%{module}/*.py[co] | |
119 | %dir %{py_sitescriptdir}/%{module}/w3c | |
120 | %{py_sitescriptdir}/%{module}/w3c/*.py[co] | |
bb02f9bf | 121 | |
28152574 | 122 | %if "%{py_ver}" > "2.4" |
bb02f9bf MK |
123 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
124 | %endif | |
125 | %endif | |
126 | ||
127 | %if %{with python3} | |
128 | %files -n python3-%{module} | |
129 | %defattr(644,root,root,755) | |
130 | %doc README.rst | |
131 | # TODO: files | |
132 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
133 | %endif | |
134 | ||
135 | %if %{with doc} | |
136 | %files apidocs | |
137 | %defattr(644,root,root,755) | |
138 | %doc docs/_build/html/* | |
28152574 | 139 | %endif |