]>
Commit | Line | Data |
---|---|---|
8455c690 AM |
1 | # Conditional build: |
2 | %bcond_without doc # Sphinx documentation | |
3 | %bcond_with tests # unit tests | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module pyxmpp2 | |
8 | %define egg_name pyxmpp2 | |
9 | %define pypi_name pyxmpp2 | |
10 | Summary: XMPP implementation for Python | |
11 | Name: python-%{pypi_name} | |
12 | Version: 2.0.1 | |
875c7828 | 13 | Release: 7 |
8455c690 AM |
14 | License: LGPL v2.1+ |
15 | Group: Libraries/Python | |
16 | #Source0: https://github.com/Jajcus/pyxmpp2/releases/download/2.0.1/pyxmpp2-2.0.1.tar.gz | |
17 | Source0: https://github.com/Jajcus/pyxmpp2/archive/%{version}.tar.gz | |
18 | # Source0-md5: add2c546f4473385c7222b623175e6ba | |
875c7828 AM |
19 | Patch0: py.patch |
20 | Patch1: tls.patch | |
21 | Patch2: newer-setuptools.patch | |
8455c690 AM |
22 | URL: https://github.com/Jajcus/pyxmpp2 |
23 | BuildRequires: rpm-pythonprov | |
24 | BuildRequires: rpmbuild(macros) >= 1.714 | |
25 | %if %{with python2} | |
26 | BuildRequires: python-modules | |
27 | BuildRequires: python-setuptools | |
28 | %if %{with tests} | |
29 | BuildRequires: python-pyasn1 | |
30 | %endif | |
31 | %endif | |
32 | %if %{with python3} | |
875c7828 | 33 | BuildRequires: python3-2to3 |
8455c690 AM |
34 | BuildRequires: python3-modules |
35 | BuildRequires: python3-setuptools | |
36 | %if %{with tests} | |
37 | BuildRequires: python3-pyasn1 | |
38 | %endif | |
39 | %endif | |
875c7828 AM |
40 | %if %{with doc} |
41 | BuildRequires: epydoc | |
42 | %endif | |
8455c690 AM |
43 | Requires: python-dns >= 1.16.0 |
44 | Requires: python-modules | |
45 | BuildArch: noarch | |
46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
47 | ||
48 | %description | |
49 | XMPP implementation for Python. | |
50 | ||
51 | %package -n python3-%{pypi_name} | |
52 | Summary: XMPP implementation for Python | |
53 | Group: Libraries/Python | |
54 | Requires: python3-dns >= 1.16.0 | |
55 | Requires: python3-modules | |
56 | ||
57 | %description -n python3-%{pypi_name} | |
58 | XMPP implementation for Python. | |
59 | ||
60 | %package apidocs | |
61 | Summary: API documentation for Python %{module} module | |
62 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module} | |
63 | Group: Documentation | |
64 | ||
65 | %description apidocs | |
66 | API documentation for Python %{module} module. | |
67 | ||
68 | %description apidocs -l pl.UTF-8 | |
69 | Dokumentacja API modułu Pythona %{module}. | |
70 | ||
71 | %prep | |
72 | %setup -q -n %{pypi_name}-%{version} | |
875c7828 AM |
73 | %patch0 -p1 |
74 | %patch1 -p1 | |
75 | %patch2 -p1 | |
76 | ||
77 | install -d orgsrc | |
78 | mv !(orgsrc) orgsrc | |
79 | %if %{with python2} | |
80 | cp -a orgsrc python2-src | |
81 | %endif | |
82 | ||
83 | %if %{with python3} | |
84 | cp -a orgsrc python3-src | |
85 | 2to3-%{py3_ver} -w --no-diffs python3-src | |
86 | %endif | |
8455c690 AM |
87 | |
88 | %build | |
89 | %if %{with python2} | |
875c7828 | 90 | cd python2-src |
8455c690 | 91 | %py_build %{?with_tests:test} |
875c7828 | 92 | cd .. |
8455c690 AM |
93 | %endif |
94 | ||
95 | %if %{with python3} | |
875c7828 | 96 | cd python3-src |
8455c690 | 97 | %py3_build %{?with_tests:test} |
875c7828 | 98 | cd .. |
8455c690 AM |
99 | %endif |
100 | ||
101 | %if %{with doc} | |
875c7828 | 102 | cd orgsrc/doc |
8455c690 | 103 | %{__make} |
875c7828 | 104 | cd .. |
8455c690 AM |
105 | %endif |
106 | ||
107 | %install | |
108 | rm -rf $RPM_BUILD_ROOT | |
109 | ||
110 | %if %{with python2} | |
875c7828 | 111 | cd python2-src |
8455c690 AM |
112 | %py_install |
113 | ||
114 | # when files are installed in other way that standard 'setup.py | |
115 | # they need to be (re-)compiled | |
116 | # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages! | |
117 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
118 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
119 | ||
120 | %py_postclean | |
875c7828 | 121 | cd .. |
8455c690 AM |
122 | %endif |
123 | ||
124 | %if %{with python3} | |
875c7828 | 125 | cd python3-src |
8455c690 | 126 | %py3_install |
875c7828 | 127 | cd .. |
8455c690 AM |
128 | %endif |
129 | ||
130 | # in case there are examples provided | |
131 | %if %{with python2} | |
875c7828 | 132 | cd python2-src |
8455c690 AM |
133 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} |
134 | cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} | |
135 | find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \ | |
136 | | xargs sed -i '1s|^#!.*python\b|#!%{__python}|' | |
875c7828 | 137 | cd .. |
8455c690 AM |
138 | %endif |
139 | %if %{with python3} | |
875c7828 | 140 | cd python3-src |
8455c690 AM |
141 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} |
142 | cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} | |
143 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \ | |
144 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
875c7828 | 145 | cd .. |
8455c690 AM |
146 | %endif |
147 | ||
148 | %clean | |
149 | rm -rf $RPM_BUILD_ROOT | |
150 | ||
151 | %if %{with python2} | |
152 | %files | |
153 | %defattr(644,root,root,755) | |
875c7828 | 154 | %doc orgsrc/{README.rst,TODO} |
8455c690 AM |
155 | %{py_sitescriptdir}/%{module} |
156 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
157 | %{_examplesdir}/python-%{pypi_name}-%{version} | |
158 | %endif | |
159 | ||
160 | %if %{with python3} | |
161 | %files -n python3-%{pypi_name} | |
162 | %defattr(644,root,root,755) | |
875c7828 | 163 | %doc orgsrc/{README.rst,TODO} |
8455c690 AM |
164 | %{py3_sitescriptdir}/%{module} |
165 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
166 | %{_examplesdir}/python3-%{pypi_name}-%{version} | |
167 | %endif | |
168 | ||
169 | %if %{with doc} | |
170 | %files apidocs | |
171 | %defattr(644,root,root,755) | |
875c7828 | 172 | %doc orgsrc/doc/www/api/* |
8455c690 | 173 | %endif |