]> git.pld-linux.org Git - packages/python-pyxmpp2.git/blob - python-pyxmpp2.spec
rel 9; rename __unicode__ methods to __str__
[packages/python-pyxmpp2.git] / python-pyxmpp2.spec
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
13 Release:        9
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 Patch0:         py.patch
20 Patch1:         tls.patch
21 Patch2:         newer-setuptools.patch
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}
33 BuildRequires:  python3-2to3
34 BuildRequires:  python3-modules
35 BuildRequires:  python3-setuptools
36 %if %{with tests}
37 BuildRequires:  python3-pyasn1
38 %endif
39 %endif
40 %if %{with doc}
41 BuildRequires:  epydoc
42 %endif
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}
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 sed -i -e 's#def __unicode__(#def __str__(#g' \
87     python3-src/pyxmpp2/*.py \
88     python3-src/auxtools/make_conformance_table.py \
89     python3-src/pyxmpp2/ext/vcard.py \
90     python3-src/pyxmpp2/test/resolver.py \
91     python3-src/pyxmpp2/mainloop/interfaces.py
92 %endif
93
94 %build
95 %if %{with python2}
96 cd python2-src
97 %py_build %{?with_tests:test}
98 cd ..
99 %endif
100
101 %if %{with python3}
102 cd python3-src
103 %py3_build %{?with_tests:test}
104 cd ..
105 %endif
106
107 %if %{with doc}
108 cd orgsrc/doc
109 %{__make}
110 cd ..
111 %endif
112
113 %install
114 rm -rf $RPM_BUILD_ROOT
115
116 %if %{with python2}
117 cd python2-src
118 %py_install
119
120 # when files are installed in other way that standard 'setup.py
121 # they need to be (re-)compiled
122 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
123 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
124 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
125
126 %py_postclean
127 cd ..
128 %endif
129
130 %if %{with python3}
131 cd python3-src
132 %py3_install
133 cd ..
134 %endif
135
136 # in case there are examples provided
137 %if %{with python2}
138 cd python2-src
139 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
140 cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
141 find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \
142         | xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
143 cd ..
144 %endif
145 %if %{with python3}
146 cd python3-src
147 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
148 cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
149 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \
150         | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
151 cd ..
152 %endif
153
154 %clean
155 rm -rf $RPM_BUILD_ROOT
156
157 %if %{with python2}
158 %files
159 %defattr(644,root,root,755)
160 %doc orgsrc/{README.rst,TODO}
161 %{py_sitescriptdir}/%{module}
162 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
163 %{_examplesdir}/python-%{pypi_name}-%{version}
164 %endif
165
166 %if %{with python3}
167 %files -n python3-%{pypi_name}
168 %defattr(644,root,root,755)
169 %doc orgsrc/{README.rst,TODO}
170 %{py3_sitescriptdir}/%{module}
171 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
172 %{_examplesdir}/python3-%{pypi_name}-%{version}
173 %endif
174
175 %if %{with doc}
176 %files apidocs
177 %defattr(644,root,root,755)
178 %doc orgsrc/doc/www/api/*
179 %endif
This page took 0.117726 seconds and 4 git commands to generate.