]>
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 | |
a194c988 | 13 | Release: 5 |
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 | |
19 | URL: https://github.com/Jajcus/pyxmpp2 | |
20 | BuildRequires: rpm-pythonprov | |
21 | BuildRequires: rpmbuild(macros) >= 1.714 | |
22 | %if %{with python2} | |
23 | BuildRequires: python-modules | |
24 | BuildRequires: python-setuptools | |
25 | %if %{with tests} | |
26 | BuildRequires: python-pyasn1 | |
27 | %endif | |
28 | %endif | |
29 | %if %{with python3} | |
30 | BuildRequires: python3-modules | |
31 | BuildRequires: python3-setuptools | |
32 | %if %{with tests} | |
33 | BuildRequires: python3-pyasn1 | |
34 | %endif | |
35 | %endif | |
36 | Requires: python-dns >= 1.16.0 | |
37 | Requires: python-modules | |
38 | BuildArch: noarch | |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
40 | ||
41 | %description | |
42 | XMPP implementation for Python. | |
43 | ||
44 | %package -n python3-%{pypi_name} | |
45 | Summary: XMPP implementation for Python | |
46 | Group: Libraries/Python | |
47 | Requires: python3-dns >= 1.16.0 | |
48 | Requires: python3-modules | |
49 | ||
50 | %description -n python3-%{pypi_name} | |
51 | XMPP implementation for Python. | |
52 | ||
53 | %package apidocs | |
54 | Summary: API documentation for Python %{module} module | |
55 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module} | |
56 | Group: Documentation | |
57 | ||
58 | %description apidocs | |
59 | API documentation for Python %{module} module. | |
60 | ||
61 | %description apidocs -l pl.UTF-8 | |
62 | Dokumentacja API modułu Pythona %{module}. | |
63 | ||
64 | %prep | |
65 | %setup -q -n %{pypi_name}-%{version} | |
66 | ||
67 | %build | |
68 | %if %{with python2} | |
69 | %py_build %{?with_tests:test} | |
70 | %endif | |
71 | ||
72 | %if %{with python3} | |
73 | %py3_build %{?with_tests:test} | |
74 | %endif | |
75 | ||
76 | %if %{with doc} | |
77 | cd doc | |
78 | %{__make} | |
79 | %endif | |
80 | ||
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
83 | ||
84 | %if %{with python2} | |
85 | %py_install | |
86 | ||
87 | # when files are installed in other way that standard 'setup.py | |
88 | # they need to be (re-)compiled | |
89 | # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages! | |
90 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
91 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
92 | ||
93 | %py_postclean | |
94 | %endif | |
95 | ||
96 | %if %{with python3} | |
97 | %py3_install | |
98 | %endif | |
99 | ||
100 | # in case there are examples provided | |
101 | %if %{with python2} | |
102 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} | |
103 | cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} | |
104 | find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \ | |
105 | | xargs sed -i '1s|^#!.*python\b|#!%{__python}|' | |
106 | %endif | |
107 | %if %{with python3} | |
108 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} | |
109 | cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} | |
110 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \ | |
111 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
112 | %endif | |
113 | ||
114 | %clean | |
115 | rm -rf $RPM_BUILD_ROOT | |
116 | ||
117 | %if %{with python2} | |
118 | %files | |
119 | %defattr(644,root,root,755) | |
120 | %doc README.rst TODO | |
121 | %{py_sitescriptdir}/%{module} | |
122 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
123 | %{_examplesdir}/python-%{pypi_name}-%{version} | |
124 | %endif | |
125 | ||
126 | %if %{with python3} | |
127 | %files -n python3-%{pypi_name} | |
128 | %defattr(644,root,root,755) | |
129 | %doc README.rst TODO | |
130 | %{py3_sitescriptdir}/%{module} | |
131 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
132 | %{_examplesdir}/python3-%{pypi_name}-%{version} | |
133 | %endif | |
134 | ||
135 | %if %{with doc} | |
136 | %files apidocs | |
137 | %defattr(644,root,root,755) | |
138 | %doc doc/www/api/* | |
139 | %endif |