1 |
%define docver 3.4.1 |
2 |
%define dirver 3.4 |
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 |
%define with_rewheel 1 |
17 |
|
18 |
# We want to byte-compile the .py files within the packages using the new |
19 |
# python3 binary. |
20 |
# |
21 |
# Unfortunately, rpmbuild's infrastructure requires us to jump through some |
22 |
# hoops to avoid byte-compiling with the system python 2 version: |
23 |
# /usr/lib/rpm/mageia/macros sets up build policy that (amongst other things) |
24 |
# defines __os_install_post. In particular, "brp-python-bytecompile" is |
25 |
# invoked without an argument thus using the wrong version of python |
26 |
# (/usr/bin/python, rather than the freshly built python), thus leading to |
27 |
# numerous syntax errors, and incorrect magic numbers in the .pyc files. We |
28 |
# thus remove the invocation of brp-python-bytecompile, whilst keeping the |
29 |
# invocation of brp-python-hardlink (since this should still work for python3 |
30 |
# pyc/pyo files) |
31 |
%define _python_bytecompile_build 0 |
32 |
|
33 |
|
34 |
Summary: An interpreted, interactive object-oriented programming language |
35 |
Name: python3 |
36 |
Version: 3.4.1 |
37 |
Release: %mkrel 4 |
38 |
License: Modified CNRI Open Source License |
39 |
Group: Development/Python |
40 |
|
41 |
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz |
42 |
Source1: https://docs.python.org/3/archives/python-%{docver}-docs-html.tar.bz2 |
43 |
Source2: python3.macros |
44 |
Source3: pybytecompile.macros |
45 |
|
46 |
Patch0: python-3.3.0-module-linkage.patch |
47 |
Patch1: python3-3.4.0-fdr-lib64.patch |
48 |
Patch2: python3-3.4.0-fdr-lib64-fix-for-test_install.patch |
49 |
Patch3: python3-3.4.0-no-static-lib.patch |
50 |
Patch4: python3-3.4.0-more-configuration-flags.patch |
51 |
Patch5: python3-3.4.0-disable-tests-in-test_io.patch |
52 |
Patch6: python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch |
53 |
Patch7: python3-3.4.0-skip-distutils-tests-that-fail-in-rpmbuild.patch |
54 |
Patch8: python3-3.4.0-hashlib-fips.patch |
55 |
Patch9: python3-3.4.0-fix-test_gdb-noise.patch |
56 |
Patch10: python3-3.4.0-uid-gid-overflows.patch |
57 |
Patch11: python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch |
58 |
Patch12: python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch |
59 |
Patch13: python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch |
60 |
Patch14: python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch |
61 |
Patch15: python3-3.4.0-dont-raise-from-py_compile.patch |
62 |
%if 0%{with_rewheel} |
63 |
Patch16: python3-3.4.0-add-rewheel-module.patch |
64 |
%endif |
65 |
# http://bugs.python.org/issue21121 |
66 |
Patch17: python3-3.4.0-dont-add-Werror-declaration-after-statement.patch |
67 |
Patch18: python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch |
68 |
# http://bugs.python.org/issue21766 |
69 |
Patch19: CVE-2014-4650.patch |
70 |
|
71 |
URL: http://www.python.org/ |
72 |
Conflicts: tkinter3 < %{version} |
73 |
Conflicts: %{lib_name}-devel < 3.4 |
74 |
Conflicts: %{develname} < 3.4 |
75 |
Requires: %{lib_name} = %{version} |
76 |
BuildRequires: automake |
77 |
BuildRequires: gcc-c++ |
78 |
BuildRequires: blt |
79 |
BuildRequires: db-devel |
80 |
BuildRequires: expat-devel |
81 |
BuildRequires: gdbm-devel |
82 |
BuildRequires: gmp-devel |
83 |
BuildRequires: libffi-devel |
84 |
BuildRequires: ncursesw-devel |
85 |
BuildRequires: openssl-devel |
86 |
BuildRequires: readline-devel |
87 |
BuildRequires: termcap-devel |
88 |
BuildRequires: tcl |
89 |
BuildRequires: tcl-devel |
90 |
BuildRequires: tk |
91 |
BuildRequires: tk-devel |
92 |
BuildRequires: autoconf |
93 |
BuildRequires: bzip2-devel |
94 |
BuildRequires: sqlite3-devel |
95 |
# uncomment once the emacs part no longer conflict with python 2.X |
96 |
#BuildRequires: emacs |
97 |
#BuildRequires: emacs-bin |
98 |
%if %{with valgrind} |
99 |
BuildRequires: valgrind-devel |
100 |
%endif |
101 |
%if 0%{?with_rewheel} |
102 |
BuildRequires: python3-setuptools |
103 |
BuildRequires: python3-pip |
104 |
%endif |
105 |
Provides: python(abi) = %{dirver} |
106 |
Provides: /usr/bin/python%{dirver}m |
107 |
Provides: /usr/bin/python%{dirver} |
108 |
|
109 |
%description |
110 |
Python is an interpreted, interactive, object-oriented programming |
111 |
language often compared to Tcl, Perl, Scheme or Java. Python includes |
112 |
modules, classes, exceptions, very high level dynamic data types and |
113 |
dynamic typing. Python supports interfaces to many system calls and |
114 |
libraries, as well as to various windowing systems (X11, Motif, Tk, |
115 |
Mac and MFC). |
116 |
|
117 |
Programmers can write new built-in modules for Python in C or C++. |
118 |
Python can be used as an extension language for applications that |
119 |
need a programmable interface. This package contains most of the |
120 |
standard Python modules, as well as modules for interfacing to the |
121 |
Tix widget set for Tk and RPM. |
122 |
|
123 |
Note that documentation for Python is provided in the python-docs |
124 |
package. |
125 |
|
126 |
%package -n %{lib_name} |
127 |
Summary: Shared libraries for Python %{version} |
128 |
Group: System/Libraries |
129 |
|
130 |
%description -n %{lib_name} |
131 |
This packages contains Python shared object library. Python is an |
132 |
interpreted, interactive, object-oriented programming language often |
133 |
compared to Tcl, Perl, Scheme or Java. |
134 |
|
135 |
%package -n %{develname} |
136 |
Summary: The libraries and header files needed for Python development |
137 |
Group: Development/Python |
138 |
Requires: %{name} = %version |
139 |
Requires: %{lib_name} = %{version} |
140 |
Provides: %{name}-devel = %{version}-%{release} |
141 |
Provides: %{lib_name_orig}-devel = %{version}-%{release} |
142 |
Obsoletes: %{_lib}python3.1-devel < %{version} |
143 |
Obsoletes: %{_lib}python3.2-devel < %{version}-%{release} |
144 |
|
145 |
%description -n %{develname} |
146 |
The Python programming language's interpreter can be extended with |
147 |
dynamically loaded extensions and can be embedded in other programs. |
148 |
This package contains the header files and libraries needed to do |
149 |
these types of tasks. |
150 |
|
151 |
Install %{develname} if you want to develop Python extensions. The |
152 |
python package will also need to be installed. You'll probably also |
153 |
want to install the python-docs package, which contains Python |
154 |
documentation. |
155 |
|
156 |
%package docs |
157 |
Summary: Documentation for the Python programming language |
158 |
Requires: %name = %version |
159 |
Requires: xdg-utils |
160 |
Group: Development/Python |
161 |
BuildArch: noarch |
162 |
|
163 |
%description docs |
164 |
The python-docs package contains documentation on the Python |
165 |
programming language and interpreter. The documentation is provided |
166 |
in ASCII text files and in LaTeX source files. |
167 |
|
168 |
Install the python-docs package if you'd like to use the documentation |
169 |
for the Python language. |
170 |
|
171 |
%package -n tkinter3 |
172 |
Summary: A graphical user interface for the Python scripting language |
173 |
Group: Development/Python |
174 |
Requires: %name = %version |
175 |
Requires: tcl tk |
176 |
Provides: python3-tkinter |
177 |
|
178 |
%description -n tkinter3 |
179 |
The Tkinter (Tk interface) program is an graphical user interface for |
180 |
the Python scripting language. |
181 |
|
182 |
You should install the tkinter package if you'd like to use a graphical |
183 |
user interface for Python programming. |
184 |
|
185 |
%package -n tkinter3-apps |
186 |
Summary: Various applications written using tkinter |
187 |
Group: Development/Python |
188 |
Requires: tkinter3 |
189 |
|
190 |
%description -n tkinter3-apps |
191 |
Various applications written using tkinter |
192 |
|
193 |
|
194 |
%prep |
195 |
%setup -qn Python-%{version} |
196 |
%patch0 -p0 -b .link |
197 |
|
198 |
%if "%{_lib}" == "lib64" |
199 |
%patch1 -p1 -b .lib64 |
200 |
%patch2 -p1 |
201 |
%endif |
202 |
|
203 |
%patch3 -p1 |
204 |
%patch4 -p1 |
205 |
%patch5 -p1 |
206 |
%patch6 -p1 |
207 |
%patch7 -p1 |
208 |
%patch8 -p1 |
209 |
%patch9 -p0 |
210 |
%patch10 -p1 |
211 |
%patch11 -p1 |
212 |
%patch12 -p1 |
213 |
%patch13 -p1 |
214 |
%patch14 -p1 |
215 |
%patch15 -p1 |
216 |
|
217 |
%if 0%{with_rewheel} |
218 |
%patch16 -p1 |
219 |
%endif |
220 |
|
221 |
%patch17 -p1 |
222 |
%patch18 -p0 |
223 |
%patch19 -p1 |
224 |
|
225 |
# drop Autoconf version requirement |
226 |
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac |
227 |
|
228 |
# docs |
229 |
mkdir html |
230 |
bzcat %{SOURCE1} | tar x -C html |
231 |
|
232 |
find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@' |
233 |
|
234 |
%build |
235 |
rm -f Modules/Setup.local |
236 |
|
237 |
export OPT="%{optflags} -g" |
238 |
|
239 |
# to fix curses module build |
240 |
# https://bugs.mageia.org/show_bug.cgi?id=6702 |
241 |
export CFLAGS="%{optflags} -I/usr/include/ncursesw" |
242 |
export CPPFLAGS="%{optflags} -I/usr/include/ncursesw" |
243 |
|
244 |
autoreconf -vfi |
245 |
# Remove -Wl,--no-undefined in accordance with MGA #9395 : |
246 |
# https://bugs.mageia.org/show_bug.cgi?id=9395 |
247 |
%define _disable_ld_no_undefined 1 |
248 |
%configure2_5x --with-threads \ |
249 |
--enable-ipv6 \ |
250 |
--with-dbmliborder=gdbm \ |
251 |
--with-system-expat \ |
252 |
--with-system-ffi \ |
253 |
--enable-shared \ |
254 |
--without-ensurepip \ |
255 |
%if %{with valgrind} |
256 |
--with-valgrind |
257 |
%endif |
258 |
|
259 |
# fix build |
260 |
#perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile |
261 |
# (misc) if the home is nfs mounted, rmdir fails due to delay |
262 |
export TMP="/tmp" TMPDIR="/tmp" |
263 |
#%make LN="ln -sf" |
264 |
make EXTRA_CFLAGS="$CFLAGS" LN="ln -sf" |
265 |
|
266 |
%install |
267 |
mkdir -p %buildroot%{_prefix}/lib/python%{dirver} |
268 |
|
269 |
# fix Makefile to get rid of reference to distcc |
270 |
perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile |
271 |
|
272 |
# set the install path |
273 |
echo '[install_scripts]' >setup.cfg |
274 |
echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg |
275 |
|
276 |
# python is not GNU and does not know fsstd |
277 |
mkdir -p %{buildroot}%{_mandir} |
278 |
%makeinstall_std LN="ln -sf" |
279 |
|
280 |
# overwrite the copied binary with a link |
281 |
pushd %{buildroot}%{_bindir} |
282 |
ln -sf python%{dirver}m python%{dirver} |
283 |
ln -sf python%{dirver} python%{familyver} |
284 |
popd |
285 |
|
286 |
(cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so) |
287 |
|
288 |
# fix files conflicting with python2.6 |
289 |
mv %{buildroot}/%{_bindir}/2to3 $RPM_BUILD_ROOT/%{_bindir}/python3-2to3 |
290 |
|
291 |
|
292 |
# install pynche as pynche3 |
293 |
cat << EOF > %{buildroot}%{_bindir}/pynche3 |
294 |
#!/bin/bash |
295 |
exec %{_libdir}/python%{dirver}/site-packages/pynche/pynche |
296 |
EOF |
297 |
rm -f Tools/pynche/*.pyw |
298 |
cp -r Tools/pynche %{buildroot}%{_libdir}/python%{dirver}/site-packages/ |
299 |
|
300 |
chmod 755 %{buildroot}%{_bindir}/{idle3,pynche3} |
301 |
|
302 |
ln -f Tools/pynche/README Tools/pynche/README.pynche |
303 |
|
304 |
%if %{with valgrind} |
305 |
install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-python3.supp |
306 |
%endif |
307 |
|
308 |
mkdir -p %{buildroot}%{_datadir}/applications |
309 |
cat > %{buildroot}%{_datadir}/applications/%_real_vendor-tkinter3.desktop << EOF |
310 |
[Desktop Entry] |
311 |
Name=IDLE |
312 |
Comment=IDE for Python3 |
313 |
Exec=%{_bindir}/idle3 |
314 |
Icon=development_environment_section |
315 |
Terminal=false |
316 |
Type=Application |
317 |
Categories=Development;IDE; |
318 |
EOF |
319 |
|
320 |
|
321 |
cat > %{buildroot}%{_datadir}/applications/%_real_vendor-%{name}-docs.desktop << EOF |
322 |
[Desktop Entry] |
323 |
Name=Python documentation |
324 |
Comment=Python complete reference |
325 |
Exec=%{_bindir}/xdg-open %_defaultdocdir/%{name}-docs/index.html |
326 |
Icon=documentation_section |
327 |
Terminal=false |
328 |
Type=Application |
329 |
Categories=Documentation; |
330 |
EOF |
331 |
|
332 |
|
333 |
# fix non real scripts |
334 |
#chmod 644 %{buildroot}%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py* |
335 |
find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" -o -name "test_htmlparser.py*" \) -exec chmod 644 {} \; |
336 |
# fix python library not stripped |
337 |
chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 $RPM_BUILD_ROOT%{_libdir}/libpython3.so |
338 |
|
339 |
|
340 |
%multiarch_includes %{buildroot}/usr/include/python*/pyconfig.h |
341 |
|
342 |
mkdir -p %{buildroot}%{_sysconfdir}/rpm/macros.d |
343 |
install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.d/ |
344 |
install -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/rpm/macros.d/ |
345 |
|
346 |
|
347 |
%check |
348 |
# (misc) if the home is nfs mounted, rmdir fails |
349 |
export TMP="/tmp" TMPDIR="/tmp" |
350 |
|
351 |
%ifarch %arm |
352 |
EXCLUDE="test_float" |
353 |
%else |
354 |
EXCLUDE="" |
355 |
%endif |
356 |
|
357 |
# all tests must pass |
358 |
# but we disable network on BS |
359 |
WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u none -x $EXCLUDE" |
360 |
# consider use network on local build |
361 |
#WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u network -x $EXCLUDE" |
362 |
|
363 |
%files |
364 |
%{_sysconfdir}/rpm/macros.d/*.macros |
365 |
%{_includedir}/python*/pyconfig.h |
366 |
%multiarch_includedir/python*/pyconfig.h |
367 |
%{_libdir}/python*/config*/Makefile |
368 |
%exclude %{_libdir}/python*/site-packages/pynche |
369 |
%exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so |
370 |
|
371 |
%dir %{_libdir}/python* |
372 |
%{_libdir}/python*/LICENSE.txt |
373 |
%{_libdir}/python%{dirver}/*.py |
374 |
%{_libdir}/python%{dirver}/__pycache__ |
375 |
%{_libdir}/python%{dirver}/collections |
376 |
%{_libdir}/python%{dirver}/concurrent |
377 |
%{_libdir}/python%{dirver}/ctypes |
378 |
%{_libdir}/python%{dirver}/curses |
379 |
%{_libdir}/python%{dirver}/dbm |
380 |
%{_libdir}/python%{dirver}/distutils |
381 |
%{_libdir}/python%{dirver}/email |
382 |
%{_libdir}/python%{dirver}/encodings |
383 |
%{_libdir}/python%{dirver}/html |
384 |
%{_libdir}/python%{dirver}/http |
385 |
%{_libdir}/python%{dirver}/importlib |
386 |
%{_libdir}/python%{dirver}/json |
387 |
%{_libdir}/python%{dirver}/lib-dynload |
388 |
%{_libdir}/python%{dirver}/lib2to3 |
389 |
%{_libdir}/python%{dirver}/logging |
390 |
%{_libdir}/python%{dirver}/multiprocessing |
391 |
%{_libdir}/python%{dirver}/plat-linux |
392 |
%{_libdir}/python%{dirver}/pydoc_data |
393 |
%{_libdir}/python%{dirver}/site-packages |
394 |
%{_libdir}/python%{dirver}/sqlite3 |
395 |
%{_libdir}/python%{dirver}/turtledemo |
396 |
%{_libdir}/python%{dirver}/unittest |
397 |
%{_libdir}/python%{dirver}/urllib |
398 |
%{_libdir}/python%{dirver}/venv |
399 |
%{_libdir}/python%{dirver}/wsgiref* |
400 |
%{_libdir}/python%{dirver}/xml |
401 |
%{_libdir}/python%{dirver}/xmlrpc |
402 |
%{_libdir}/python%{dirver}/asyncio |
403 |
%{_libdir}/python%{dirver}/ensurepip |
404 |
%exclude %{_libdir}/python%{dirver}/ensurepip/_bundled |
405 |
%if 0%{?with_rewheel} |
406 |
%dir %{_libdir}/python%{dirver}/ensurepip/rewheel/ |
407 |
%{_libdir}/python%{dirver}/ensurepip/rewheel/*.py |
408 |
%{_libdir}/python%{dirver}/ensurepip/rewheel/__pycache__/ |
409 |
%endif |
410 |
%{_bindir}/pydoc3* |
411 |
%{_bindir}/python3* |
412 |
%{_bindir}/pyvenv* |
413 |
%{_bindir}/2to3-%{dirver} |
414 |
%exclude %{_bindir}/python*config |
415 |
#%{_datadir}/emacs/site-lisp/* |
416 |
%{_mandir}/man*/* |
417 |
%if %{with valgrind} |
418 |
%{_libdir}/valgrind/valgrind-python3.supp |
419 |
%endif |
420 |
|
421 |
%files -n %{lib_name} |
422 |
%{_libdir}/libpython*.so.1* |
423 |
|
424 |
%files -n %{develname} |
425 |
%{_libdir}/libpython*.so |
426 |
%{_includedir}/python* |
427 |
%{_libdir}/python*/config-%{dirver}* |
428 |
%{_libdir}/python*/test/ |
429 |
%{_bindir}/python%{dirver}*-config |
430 |
%{_bindir}/python%{familyver}-config |
431 |
%{_libdir}/pkgconfig/python*.pc |
432 |
%exclude %{_includedir}/python*/pyconfig.h |
433 |
%exclude %{_libdir}/python*/config*/Makefile |
434 |
|
435 |
%files docs |
436 |
%doc html/*/* |
437 |
%{_datadir}/applications/%_real_vendor-%{name}-docs.desktop |
438 |
|
439 |
%files -n tkinter3 |
440 |
%{_libdir}/python*/tkinter/ |
441 |
%{_libdir}/python*/idlelib |
442 |
%{_libdir}/python*/site-packages/pynche |
443 |
%{_libdir}/python*/lib-dynload/_tkinter.*.so |
444 |
|
445 |
%files -n tkinter3-apps |
446 |
%{_bindir}/idle3* |
447 |
%{_bindir}/pynche3 |
448 |
%{_datadir}/applications/%_real_vendor-tkinter3.desktop |
449 |
|