]>
Commit | Line | Data |
---|---|---|
1bac47b5 | 1 | # |
3690c9ea | 2 | # Conditional build: |
9c9005f2 MK |
3 | %bcond_with doc # don't build doc |
4 | %bcond_with tests # do not perform "make test" | |
3690c9ea MK |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
9c9005f2 MK |
8 | %define module PyPDF2 |
9 | Summary: A Pure-Python library built as a PDF toolkit | |
10 | Summary(pl.UTF-8): Czysto Pythonowa biblioteka narzędzi dla PDF | |
3690c9ea | 11 | Name: python-%{module} |
9c9005f2 | 12 | Version: 1.26.0 |
61ca632b | 13 | Release: 6 |
9c9005f2 | 14 | License: BSD |
3690c9ea | 15 | Group: Libraries/Python |
1bac47b5 | 16 | Source0: https://pypi.python.org/packages/b4/01/68fcc0d43daf4c6bdbc6b33cc3f77bda531c86b174cac56ef0ffdb96faab/%{module}-%{version}.tar.gz |
9c9005f2 MK |
17 | # Source0-md5: 2301acc0ecbab0633d4c9b883d50ee5e |
18 | URL: http://mstamy2.github.com/PyPDF2 | |
3690c9ea MK |
19 | BuildRequires: rpm-pythonprov |
20 | # for the py_build, py_install macros | |
21 | BuildRequires: rpmbuild(macros) >= 1.714 | |
22 | %if %{with python2} | |
23 | BuildRequires: python-modules | |
3690c9ea MK |
24 | %endif |
25 | %if %{with python3} | |
26 | BuildRequires: python3-modules | |
3690c9ea | 27 | %endif |
3690c9ea MK |
28 | Requires: python-modules |
29 | BuildArch: noarch | |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
31 | ||
32 | %description | |
9c9005f2 MK |
33 | A Pure-Python library built as a PDF toolkit. It is capable of: |
34 | extracting document information (title, author, etc) splitting | |
35 | documents page by page merging documents page by page cropping pages | |
36 | merging multiple pages into a single page encrypting and decrypting | |
37 | PDF files and more! | |
3690c9ea MK |
38 | |
39 | %description -l pl.UTF-8 | |
9c9005f2 MK |
40 | Czysto Pythonowa bibliotek narzędziowa pozwalająca na: uzyskiwanie |
41 | informacji o dokumentach (tytuł, autor itp) dzielenie dokumentów na | |
42 | strony sklejanie dokumentów z pojedynczych stron elimancje marginesów | |
43 | sklejanie stron w jedną stronę szyfrowanie i odszyfrowywanie plików | |
44 | PDF. | |
3690c9ea MK |
45 | |
46 | %package -n python3-%{module} | |
1bac47b5 ER |
47 | Summary: A Pure-Python library built as a PDF toolkit |
48 | Summary(pl.UTF-8): Czysto Pythonowa biblioteka narzędzi dla PDF | |
3690c9ea MK |
49 | Group: Libraries/Python |
50 | Requires: python3-modules | |
51 | ||
52 | %description -n python3-%{module} | |
9c9005f2 MK |
53 | A Pure-Python library built as a PDF toolkit. It is capable of: |
54 | extracting document information (title, author, etc) splitting | |
55 | documents page by page merging documents page by page cropping pages | |
56 | merging multiple pages into a single page encrypting and decrypting | |
57 | PDF files and more! | |
3690c9ea MK |
58 | |
59 | %description -n python3-%{module} -l pl.UTF-8 | |
9c9005f2 MK |
60 | Czysto Pythonowa bibliotek narzędziowa pozwalająca na: uzyskiwanie |
61 | informacji o dokumentach (tytuł, autor itp) dzielenie dokumentów na | |
62 | strony sklejanie dokumentów z pojedynczych stron elimancje marginesów | |
63 | sklejanie stron w jedną stronę szyfrowanie i odszyfrowywanie plików | |
64 | PDF. | |
3690c9ea MK |
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}. | |
76 | ||
77 | %prep | |
78 | %setup -q -n %{module}-%{version} | |
79 | ||
3690c9ea MK |
80 | %build |
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 | |
88 | ||
89 | %if %{with doc} | |
90 | cd docs | |
91 | %{__make} -j1 html | |
92 | rm -rf _build/html/_sources | |
93 | %endif | |
94 | ||
95 | %install | |
96 | rm -rf $RPM_BUILD_ROOT | |
3690c9ea MK |
97 | %if %{with python2} |
98 | %py_install | |
3690c9ea | 99 | %py_postclean |
3690c9ea | 100 | |
1bac47b5 ER |
101 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} |
102 | cp -a Sample_Code/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
103 | find $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} -name '*.py' \ | |
104 | | xargs sed -i '1s|^#!.*python\b|#!%{__python}|' | |
3690c9ea | 105 | %endif |
eb4f9807 | 106 | |
3690c9ea | 107 | %if %{with python3} |
eb4f9807 ER |
108 | %py3_install |
109 | ||
3690c9ea | 110 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
9c9005f2 | 111 | cp -a Sample_Code/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
3690c9ea | 112 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ |
1bac47b5 | 113 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' |
3690c9ea MK |
114 | %endif |
115 | ||
116 | %clean | |
117 | rm -rf $RPM_BUILD_ROOT | |
118 | ||
119 | %if %{with python2} | |
120 | %files | |
121 | %defattr(644,root,root,755) | |
9c9005f2 | 122 | %doc CHANGELOG README.md |
3690c9ea | 123 | %{py_sitescriptdir}/%{module} |
3690c9ea | 124 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
3690c9ea MK |
125 | %{_examplesdir}/%{name}-%{version} |
126 | %endif | |
127 | ||
128 | %if %{with python3} | |
129 | %files -n python3-%{module} | |
130 | %defattr(644,root,root,755) | |
9c9005f2 | 131 | %doc CHANGELOG README.md |
3690c9ea MK |
132 | %{py3_sitescriptdir}/%{module} |
133 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
134 | %{_examplesdir}/python3-%{module}-%{version} | |
135 | %endif | |
136 | ||
137 | %if %{with doc} | |
138 | %files apidocs | |
139 | %defattr(644,root,root,755) | |
140 | %doc docs/_build/html/* | |
141 | %endif |