1 |
%define docver 3.3.4 |
2 |
%define dirver 3.3 |
3 |
%define familyver 3 |
4 |
|
5 |
%define lib_major %{dirver} |
6 |
%define lib_name_orig libpython%{familyver} |
7 |
%define lib_name %mklibname python %{lib_major} |
8 |
%define develname %mklibname python3 -d |
9 |
|
10 |
%ifarch %{ix86} x86_64 ppc |
11 |
%bcond_without valgrind |
12 |
%else |
13 |
%bcond_with valgrind |
14 |
%endif |
15 |
|
16 |
# We want to byte-compile the .py files within the packages using the new |
17 |
# python3 binary. |
18 |
# |
19 |
# Unfortunately, rpmbuild's infrastructure requires us to jump through some |
20 |
# hoops to avoid byte-compiling with the system python 2 version: |
21 |
# /usr/lib/rpm/mageia/macros sets up build policy that (amongst other things) |
22 |
# defines __os_install_post. In particular, "brp-python-bytecompile" is |
23 |
# invoked without an argument thus using the wrong version of python |
24 |
# (/usr/bin/python, rather than the freshly built python), thus leading to |
25 |
# numerous syntax errors, and incorrect magic numbers in the .pyc files. We |
26 |
# thus remove the invocation of brp-python-bytecompile, whilst keeping the |
27 |
# invocation of brp-python-hardlink (since this should still work for python3 |
28 |
# pyc/pyo files) |
29 |
%define _python_bytecompile_build 0 |
30 |
|
31 |
|
32 |
Summary: An interpreted, interactive object-oriented programming language |
33 |
Name: python3 |
34 |
Version: 3.3.4 |
35 |
Release: %mkrel 2 |
36 |
License: Modified CNRI Open Source License |
37 |
Group: Development/Python |
38 |
|
39 |
Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz |
40 |
Source1: http://www.python.org/ftp/python/doc/%{docver}/python-%{docver}-docs-html.tar.bz2 |
41 |
Source2: python3.macros |
42 |
Source3: pybytecompile.macros |
43 |
#Source4: python-mode-1.0.tar.bz2 |
44 |
|
45 |
Patch0: python-3.3.0-module-linkage.patch |
46 |
Patch1: python3-3.3.0-fdr-lib64.patch |
47 |
Patch2: python3-3.2.3-fdr-lib64-fix-for-test_install.patch |
48 |
Patch4: python-3.3.0b1-test-posix_fadvise.patch |
49 |
Patch8: python-3.3.0-CVE-2014-2667.patch |
50 |
#Fedora patches: |
51 |
Patch153: 00153-fix-test_gdb-noise.patch |
52 |
Patch156: 00156-gdb-autoload-safepath.patch |
53 |
# 00173 # |
54 |
# Workaround for ENOPROTOOPT seen in bs within |
55 |
# test.test_support.bind_port() |
56 |
# from Fedora (rhbz#913732) |
57 |
Patch173: 00173-workaround-ENOPROTOOPT-in-bind_port.patch |
58 |
Patch179: 00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch |
59 |
|
60 |
URL: http://www.python.org/ |
61 |
Conflicts: tkinter3 < %{version} |
62 |
Conflicts: %{lib_name}-devel < 3.1.2-4 |
63 |
Conflicts: %{develname} < 3.2.2-3 |
64 |
Requires: %{lib_name} = %{version} |
65 |
BuildRequires: blt |
66 |
BuildRequires: db-devel |
67 |
BuildRequires: expat-devel |
68 |
BuildRequires: gdbm-devel |
69 |
BuildRequires: gmp-devel |
70 |
BuildRequires: libffi-devel |
71 |
BuildRequires: ncursesw-devel |
72 |
BuildRequires: openssl-devel |
73 |
BuildRequires: readline-devel |
74 |
BuildRequires: termcap-devel |
75 |
BuildRequires: tcl tcl-devel |
76 |
BuildRequires: tk tk-devel |
77 |
BuildRequires: autoconf |
78 |
BuildRequires: bzip2-devel |
79 |
BuildRequires: sqlite3-devel |
80 |
# uncomment once the emacs part no longer conflict with python 2.X |
81 |
#BuildRequires: emacs |
82 |
#BuildRequires: emacs-bin |
83 |
%if %{with valgrind} |
84 |
BuildRequires: valgrind-devel |
85 |
%endif |
86 |
Provides: python(abi) = %{dirver} |
87 |
Provides: /usr/bin/python%{dirver}m |
88 |
Provides: /usr/bin/python%{dirver} |
89 |
|
90 |
%description |
91 |
Python is an interpreted, interactive, object-oriented programming |
92 |
language often compared to Tcl, Perl, Scheme or Java. Python includes |
93 |
modules, classes, exceptions, very high level dynamic data types and |
94 |
dynamic typing. Python supports interfaces to many system calls and |
95 |
libraries, as well as to various windowing systems (X11, Motif, Tk, |
96 |
Mac and MFC). |
97 |
|
98 |
Programmers can write new built-in modules for Python in C or C++. |
99 |
Python can be used as an extension language for applications that |
100 |
need a programmable interface. This package contains most of the |
101 |
standard Python modules, as well as modules for interfacing to the |
102 |
Tix widget set for Tk and RPM. |
103 |
|
104 |
Note that documentation for Python is provided in the python-docs |
105 |
package. |
106 |
|
107 |
%package -n %{lib_name} |
108 |
Summary: Shared libraries for Python %{version} |
109 |
Group: System/Libraries |
110 |
|
111 |
%description -n %{lib_name} |
112 |
This packages contains Python shared object library. Python is an |
113 |
interpreted, interactive, object-oriented programming language often |
114 |
compared to Tcl, Perl, Scheme or Java. |
115 |
|
116 |
%package -n %{develname} |
117 |
Summary: The libraries and header files needed for Python development |
118 |
Group: Development/Python |
119 |
Requires: %{name} = %version |
120 |
Requires: %{lib_name} = %{version} |
121 |
Provides: %{name}-devel = %{version}-%{release} |
122 |
Provides: %{lib_name_orig}-devel = %{version}-%{release} |
123 |
Obsoletes: %{_lib}python3.1-devel < %{version} |
124 |
Obsoletes: %{_lib}python3.2-devel < %{version}-%{release} |
125 |
|
126 |
%description -n %{develname} |
127 |
The Python programming language's interpreter can be extended with |
128 |
dynamically loaded extensions and can be embedded in other programs. |
129 |
This package contains the header files and libraries needed to do |
130 |
these types of tasks. |
131 |
|
132 |
Install %{develname} if you want to develop Python extensions. The |
133 |
python package will also need to be installed. You'll probably also |
134 |
want to install the python-docs package, which contains Python |
135 |
documentation. |
136 |
|
137 |
%package docs |
138 |
Summary: Documentation for the Python programming language |
139 |
Requires: %name = %version |
140 |
Requires: xdg-utils |
141 |
Group: Development/Python |
142 |
BuildArch: noarch |
143 |
|
144 |
%description docs |
145 |
The python-docs package contains documentation on the Python |
146 |
programming language and interpreter. The documentation is provided |
147 |
in ASCII text files and in LaTeX source files. |
148 |
|
149 |
Install the python-docs package if you'd like to use the documentation |
150 |
for the Python language. |
151 |
|
152 |
%package -n tkinter3 |
153 |
Summary: A graphical user interface for the Python scripting language |
154 |
Group: Development/Python |
155 |
Requires: %name = %version |
156 |
Requires: tcl tk |
157 |
Provides: python3-tkinter |
158 |
|
159 |
%description -n tkinter3 |
160 |
The Tkinter (Tk interface) program is an graphical user interface for |
161 |
the Python scripting language. |
162 |
|
163 |
You should install the tkinter package if you'd like to use a graphical |
164 |
user interface for Python programming. |
165 |
|
166 |
%package -n tkinter3-apps |
167 |
Summary: Various applications written using tkinter |
168 |
Group: Development/Python |
169 |
Requires: tkinter3 |
170 |
|
171 |
%description -n tkinter3-apps |
172 |
Various applications written using tkinter |
173 |
|
174 |
%prep |
175 |
%setup -qn Python-%{version} |
176 |
%patch0 -p0 -b .link |
177 |
|
178 |
%if "%{_lib}" == "lib64" |
179 |
%patch1 -p1 -b .lib64 |
180 |
%patch2 -p1 |
181 |
%endif |
182 |
%patch4 -p1 |
183 |
%patch8 -p1 |
184 |
%patch153 -p0 |
185 |
%patch156 -p1 |
186 |
%patch173 -p1 |
187 |
%patch179 -p1 |
188 |
|
189 |
# docs |
190 |
mkdir html |
191 |
bzcat %{SOURCE1} | tar x -C html |
192 |
|
193 |
find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@' |
194 |
|
195 |
%build |
196 |
rm -f Modules/Setup.local |
197 |
|
198 |
export OPT="%{optflags} -g" |
199 |
|
200 |
# to fix curses module build |
201 |
# https://bugs.mageia.org/show_bug.cgi?id=6702 |
202 |
export CFLAGS="%{optflags} -I/usr/include/ncursesw" |
203 |
export CPPFLAGS="%{optflags} -I/usr/include/ncursesw" |
204 |
|
205 |
autoreconf -vfi |
206 |
# Remove -Wl,--no-undefined in accordance with MGA #9395 : |
207 |
# https://bugs.mageia.org/show_bug.cgi?id=9395 |
208 |
%define _disable_ld_no_undefined 1 |
209 |
%configure2_5x --with-threads \ |
210 |
--enable-ipv6 \ |
211 |
--with-dbmliborder=gdbm \ |
212 |
--with-system-expat \ |
213 |
--with-system-ffi \ |
214 |
--enable-shared \ |
215 |
%if %{with valgrind} |
216 |
--with-valgrind |
217 |
%endif |
218 |
|
219 |
# fix build |
220 |
#perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile |
221 |
# (misc) if the home is nfs mounted, rmdir fails due to delay |
222 |
export TMP="/tmp" TMPDIR="/tmp" |
223 |
#%make LN="ln -sf" |
224 |
make EXTRA_CFLAGS="$CFLAGS" LN="ln -sf" |
225 |
|
226 |
%install |
227 |
mkdir -p %buildroot%{_prefix}/lib/python%{dirver} |
228 |
|
229 |
# fix Makefile to get rid of reference to distcc |
230 |
perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile |
231 |
|
232 |
# set the install path |
233 |
echo '[install_scripts]' >setup.cfg |
234 |
echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg |
235 |
|
236 |
# python is not GNU and does not know fsstd |
237 |
mkdir -p %{buildroot}%{_mandir} |
238 |
%makeinstall_std LN="ln -sf" |
239 |
|
240 |
(cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so) |
241 |
|
242 |
# fix files conflicting with python2.6 |
243 |
mv %{buildroot}/%{_bindir}/2to3 $RPM_BUILD_ROOT/%{_bindir}/python3-2to3 |
244 |
|
245 |
|
246 |
# install pynche as pynche3 |
247 |
cat << EOF > %{buildroot}%{_bindir}/pynche3 |
248 |
#!/bin/bash |
249 |
exec %{_libdir}/python%{dirver}/site-packages/pynche/pynche |
250 |
EOF |
251 |
rm -f Tools/pynche/*.pyw |
252 |
cp -r Tools/pynche %{buildroot}%{_libdir}/python%{dirver}/site-packages/ |
253 |
|
254 |
chmod 755 %{buildroot}%{_bindir}/{idle3,pynche3} |
255 |
|
256 |
ln -f Tools/pynche/README Tools/pynche/README.pynche |
257 |
|
258 |
%if %{with valgrind} |
259 |
install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-python3.supp |
260 |
%endif |
261 |
|
262 |
mkdir -p %{buildroot}%{_datadir}/applications |
263 |
cat > %{buildroot}%{_datadir}/applications/%_real_vendor-tkinter3.desktop << EOF |
264 |
[Desktop Entry] |
265 |
Name=IDLE |
266 |
Comment=IDE for Python3 |
267 |
Exec=%{_bindir}/idle3 |
268 |
Icon=development_environment_section |
269 |
Terminal=false |
270 |
Type=Application |
271 |
Categories=Development;IDE; |
272 |
EOF |
273 |
|
274 |
|
275 |
cat > %{buildroot}%{_datadir}/applications/%_real_vendor-%{name}-docs.desktop << EOF |
276 |
[Desktop Entry] |
277 |
Name=Python documentation |
278 |
Comment=Python complete reference |
279 |
Exec=%{_bindir}/xdg-open %_defaultdocdir/%{name}-docs/index.html |
280 |
Icon=documentation_section |
281 |
Terminal=false |
282 |
Type=Application |
283 |
Categories=Documentation; |
284 |
EOF |
285 |
|
286 |
|
287 |
# fix non real scripts |
288 |
#chmod 644 %{buildroot}%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py* |
289 |
find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" -o -name "test_htmlparser.py*" \) -exec chmod 644 {} \; |
290 |
# fix python library not stripped |
291 |
chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 $RPM_BUILD_ROOT%{_libdir}/libpython3.so |
292 |
|
293 |
|
294 |
%multiarch_includes %{buildroot}/usr/include/python*/pyconfig.h |
295 |
|
296 |
mkdir -p %{buildroot}%{_sysconfdir}/rpm/macros.d |
297 |
install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.d/ |
298 |
install -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/rpm/macros.d/ |
299 |
|
300 |
%check |
301 |
# (misc) if the home is nfs mounted, rmdir fails |
302 |
export TMP="/tmp" TMPDIR="/tmp" |
303 |
|
304 |
%ifarch %arm |
305 |
%define custom_test -x test_float |
306 |
%else |
307 |
%define custom_test "" |
308 |
%endif |
309 |
|
310 |
# all tests must pass |
311 |
# (misc, 28/11/2006) test_shutil is causing problem in iurt, it seems to remove /tmp, |
312 |
# which make other test fail |
313 |
# (misc, 11/12/2006) test_pyexpat is icrashing, seem to be done on purpose ( http://python.org/sf/1296433 ) |
314 |
# (misc, 11/12/2006) test_minidom is not working anymore, something changed either on my computer |
315 |
# or elsewhere. |
316 |
# (misc, 11/12/2006) test_sax fail too, will take a look later |
317 |
# (misc, 21/08/2007) test_string and test_str segfault, test_unicode, test_userstring, I need to pass the package as a security update |
318 |
# (eugeni, 21/07/2009) test_distutils fails with python3.1 due to ld error |
319 |
# (eugeni, 22/07/2009) test_mailbox fails on the BS |
320 |
# (eugeni, 17/08/2009) test_telnetlib fails with a connection reset by peer message |
321 |
# (tv, 31/08/2013à test_gdb, test_urllibnet & test_urllib2net fails |
322 |
# test test_sax failed -- 1 of 44 tests failed: test_xmlgen_attr_escape |
323 |
WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-w -x test_linuxaudiodev -x test_nis -x test_shutil -x test_pyexpat -x test_minidom -x test_sax -x test_string -x test_str -x test_unicode -x test_userstring -x test_bytes -x test_distutils -x test_mailbox -x test_ioctl -x test_telnetlib -x test_runpy -x test_importlib -x test_import -x test_urllibnet -x test_gdb -x test_urllib2net -x test_urllib2_localnet -x test_timeout -x test_ssl -x test_sqlite %custom_test" |
324 |
|
325 |
%files |
326 |
%{_sysconfdir}/rpm/macros.d/*.macros |
327 |
%{_includedir}/python*/pyconfig.h |
328 |
%multiarch_includedir/python*/pyconfig.h |
329 |
%{_libdir}/python*/config*/Makefile |
330 |
%exclude %{_libdir}/python*/site-packages/pynche |
331 |
%exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so |
332 |
|
333 |
# HACK: build fails without this (TODO: investigate rpm) |
334 |
%dir %{_libdir}/python* |
335 |
%{_libdir}/python*/LICENSE.txt |
336 |
%{_libdir}/python%{dirver}/*.py |
337 |
%{_libdir}/python%{dirver}/__pycache__ |
338 |
%{_libdir}/python%{dirver}/collections |
339 |
%{_libdir}/python%{dirver}/concurrent |
340 |
%{_libdir}/python%{dirver}/ctypes |
341 |
%{_libdir}/python%{dirver}/curses |
342 |
%{_libdir}/python%{dirver}/dbm |
343 |
%{_libdir}/python%{dirver}/distutils |
344 |
%{_libdir}/python%{dirver}/email |
345 |
%{_libdir}/python%{dirver}/encodings |
346 |
%{_libdir}/python%{dirver}/html |
347 |
%{_libdir}/python%{dirver}/http |
348 |
%{_libdir}/python%{dirver}/importlib |
349 |
%{_libdir}/python%{dirver}/json |
350 |
%{_libdir}/python%{dirver}/lib-dynload |
351 |
%{_libdir}/python%{dirver}/lib2to3 |
352 |
%{_libdir}/python%{dirver}/logging |
353 |
%{_libdir}/python%{dirver}/multiprocessing |
354 |
%{_libdir}/python%{dirver}/plat-linux |
355 |
%{_libdir}/python%{dirver}/pydoc_data |
356 |
%{_libdir}/python%{dirver}/site-packages |
357 |
%{_libdir}/python%{dirver}/sqlite3 |
358 |
%{_libdir}/python%{dirver}/turtledemo |
359 |
%{_libdir}/python%{dirver}/unittest |
360 |
%{_libdir}/python%{dirver}/urllib |
361 |
%{_libdir}/python%{dirver}/venv |
362 |
%{_libdir}/python%{dirver}/wsgiref* |
363 |
%{_libdir}/python%{dirver}/xml |
364 |
%{_libdir}/python%{dirver}/xmlrpc |
365 |
%{_bindir}/pydoc3* |
366 |
%{_bindir}/python3* |
367 |
%{_bindir}/pyvenv* |
368 |
%{_bindir}/2to3-%{dirver} |
369 |
%exclude %{_bindir}/python*config |
370 |
#%{_datadir}/emacs/site-lisp/* |
371 |
%{_mandir}/man*/* |
372 |
%if %{with valgrind} |
373 |
%{_libdir}/valgrind/valgrind-python3.supp |
374 |
%endif |
375 |
|
376 |
%files -n %{lib_name} |
377 |
%{_libdir}/libpython*.so.1* |
378 |
|
379 |
%files -n %{develname} |
380 |
%{_libdir}/libpython*.so |
381 |
%{_includedir}/python* |
382 |
%{_libdir}/python*/config-%{dirver}* |
383 |
%{_libdir}/python*/test/ |
384 |
%{_bindir}/python%{dirver}*-config |
385 |
%{_bindir}/python%{familyver}-config |
386 |
%{_libdir}/pkgconfig/python*.pc |
387 |
%exclude %{_includedir}/python*/pyconfig.h |
388 |
%exclude %{_libdir}/python*/config*/Makefile |
389 |
|
390 |
%files docs |
391 |
%doc html/*/* |
392 |
%{_datadir}/applications/%_real_vendor-%{name}-docs.desktop |
393 |
|
394 |
%files -n tkinter3 |
395 |
%{_libdir}/python*/tkinter/ |
396 |
%{_libdir}/python*/idlelib |
397 |
%{_libdir}/python*/site-packages/pynche |
398 |
%{_libdir}/python*/lib-dynload/_tkinter.*.so |
399 |
|
400 |
%files -n tkinter3-apps |
401 |
%{_bindir}/idle3* |
402 |
%{_bindir}/pynche3 |
403 |
%{_datadir}/applications/%_real_vendor-tkinter3.desktop |
404 |
|