/[packages]/cauldron/python3/current/SPECS/python3.spec
ViewVC logotype

Contents of /cauldron/python3/current/SPECS/python3.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1673182 - (show annotations) (download)
Sun Jan 24 10:56:50 2021 UTC (3 years, 2 months ago) by wally
File size: 33956 byte(s)
- use Fedora patch to fix CVE-2021-3177 (SILENT)
1 # NOTES ON BOOTSTRAPING PYTHON 3.x:
2 #
3 # Due to a dependency cycle between Python, rpm, pip, setuptools, wheel,
4 # and other packages, in order to rebase Python 3 one has to build in the
5 # following order:
6 #
7 # 1. gdb %%bcond_with python
8 # 2. rpm-mageia-setup %%bcond_without bootstrap
9 # 3. python-rpm-generators %%bcond_without bootstrap
10 # 4 python3 (if python3 is build to core/udpates_testing there's no need to use %bcond_with rpmwheels)
11 # 5. python-setuptools %%bcond_without bootstrap
12 # 6. python-rpm-generators %%bcond_with bootstrap
13 # 7. python-pip %%bcond_without bootstrap
14 # 8. python-wheel %%bcond_without bootstrap
15 # 9. python-setuptools %%bcond_with bootstrap
16 # 10. python-pip %%bcond_with bootstrap
17 # 11. python-wheel %%bcond_with bootstrap
18 # 12. rpm
19 # 13. python-cython
20 # 14. python-numpy
21 # 15. boost
22 # 16. gdb %%bcond_without python
23 # 17. meson
24 # 18. python-coverage
25 # 19. python-nose
26 # 20. python-yaml
27 # 21. python-markdown
28 # 22. python-markupsafe
29 # 23. python-beaker
30 # 24. python-setuptools_scm
31 # 25. python-dateutil
32 # 26. python-six
33 # 27. python-pbr
34 # 28. python-argparse
35 # 29. python-traceback2
36 # 30. python-linecache2
37 # 31. python-unittest2
38 # 32. python-funcsigs
39 # 33. python-mock
40 # 34. python-mako
41 # 35 python-pygments
42 # 36. gobject-introspection
43 # 37. python-enchant
44 # 38. file
45 # 39. rpmlint
46 # 40. rpm-mageia-setup %%bcond_with bootstrap
47
48 # Then the most important packages have to be built, starting from their
49 # various leaf dependencies recursively. After these have been built, a
50 # targeted rebuild should be requested for the rest.
51 #
52 # Currently these packages are recommended to have been built before a targeted
53 # rebuild after a python abi change:
54 # python-sphinx, python-pytest, python-requests
55
56 %global pybasever 3.8
57 %global familyver 3
58
59 # pybasever without the dot:
60 %global pyshortver 38
61
62 # version
63 %global version 3.8.7
64 %global docver %{version}
65
66 # comment out if not prerel
67 #global prerel rc1
68
69 # rel for bumping
70 %global rel 2
71
72 # filter out bogus requires on python(abi) = 3.6 for testsuite
73 %global __requires_exclude_from %{?__requires_exclude_from:%__requires_exclude_from|}^%{_libdir}/python%{pybasever}/test/test_importlib/data
74
75 # For bootstrapping python3.x to python3.y
76 %bcond_with bootstrap
77
78 # Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
79 # Uses upstream bundled prebuilt wheels otherwise
80 %bcond_without rpmwheels
81 # The following versions of setuptools/pip are bundled when this patch is not applied.
82 # The versions are written in Lib/ensurepip/__init__.py, this patch removes them.
83 # When the bundled setuptools/pip wheel is updated, the patch no longer applies cleanly.
84 # In such cases, the patch needs to be amended and the versions updated here:
85 %global pip_version 20.2.3
86 %global setuptools_version 49.2.1
87
88 # Expensive optimizations (mainly, profile-guided optimizations)
89 %bcond_without optimizations
90
91 # Run the test suite in %%check
92 %bcond_without tests
93
94 # Support for the GDB debugger
95 %bcond_with gdb_hooks
96
97 # The dbm.gnu module (key-value database)
98 %bcond_without gdbm
99
100 # Main interpreter loop optimization
101 %bcond_without computed_gotos
102
103 # Support for the Valgrind debugger/profiler
104 %ifarch %{valgrind_arches}
105 %bcond_without valgrind
106 %else
107 %bcond_with valgrind
108 %endif
109
110
111 # =====================
112 # General global macros
113 # =====================
114
115 %global pylibdir %{_libdir}/python%{pybasever}
116 %global dynload_dir %{pylibdir}/lib-dynload
117 %global site_packages %{pylibdir}/site-packages
118
119 # ABIFLAGS, LDVERSION and SOABI are in the upstream configure.ac
120 # See PEP 3149 for some background: http://www.python.org/dev/peps/pep-3149/
121 %global ABIFLAGS_optimized %{nil}
122
123 %global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized}
124
125 %global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu}
126
127 # All bytecode files are in a __pycache__ subdirectory, with a name
128 # reflecting the version of the bytecode.
129 # See PEP 3147: http://www.python.org/dev/peps/pep-3147/
130 # For example,
131 # foo/bar.py
132 # has bytecode at:
133 # foo/__pycache__/bar.cpython-%%{pyshortver}.pyc
134 # foo/__pycache__/bar.cpython-%%{pyshortver}.opt-1.pyc
135 # foo/__pycache__/bar.cpython-%%{pyshortver}.opt-2.pyc
136 %global bytecode_suffixes .cpython-%{pyshortver}*.pyc
137
138 # Disable automatic bytecompilation. The python3 binary is not yet be
139 # available in /usr/bin when Python is built. Also, the bytecompilation fails
140 # on files that test invalid syntax.
141 %global __brp_python_bytecompile %nil
142
143 %define lib_major %{pybasever}
144 %define lib_name_orig libpython%{familyver}
145 %define lib_name %mklibname python %{lib_major}
146 %define develname %mklibname python3 -d
147
148 Summary: An interpreted, interactive object-oriented programming language
149 Name: python3
150 Version: %{version}
151 Release: %mkrel %{?prerel:0.%prerel.}%{rel}
152 License: Modified CNRI Open Source License
153 Group: Development/Python
154
155 BuildRequires: automake
156 BuildRequires: gcc-c++
157 BuildRequires: blt
158 BuildRequires: pkgconfig(bluez)
159 BuildRequires: db-devel
160 BuildRequires: pkgconfig(expat)
161 BuildRequires: gdbm-devel
162 BuildRequires: gmp-devel
163 BuildRequires: pkgconfig(libffi)
164 BuildRequires: pkgconfig(libnsl)
165 BuildRequires: pkgconfig(ncursesw)
166 BuildRequires: pkgconfig(openssl) >= 1.1
167 BuildRequires: libtirpc-devel
168 BuildRequires: readline-devel
169 BuildRequires: termcap-devel
170 BuildRequires: tcl
171 BuildRequires: pkgconfig(tcl)
172 BuildRequires: tk
173 BuildRequires: pkgconfig(tk)
174 BuildRequires: autoconf
175 BuildRequires: pkgconfig(bzip2)
176 BuildRequires: pkgconfig(sqlite3)
177 BuildRequires: pkgconfig(liblzma)
178 # uncomment once the emacs part no longer conflict with python 2.X
179 #BuildRequires: emacs
180 #BuildRequires: emacs-bin
181 %if %{with valgrind}
182 BuildRequires: pkgconfig(valgrind)
183 %endif
184
185 BuildRequires: systemtap-sdt-devel
186
187 %if %{with rpmwheels}
188 BuildRequires: python-setuptools-wheel >= %{setuptools_version}
189 BuildRequires: python-pip-wheel >= %{pip_version}
190 %endif
191
192 %if %{without bootstrap}
193 # for make regen-all and distutils.tests.test_bdist_rpm
194 BuildRequires: python3
195 %endif
196
197 Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}%{?prerel}.tar.xz
198 Source1: https://docs.python.org/%{pybasever}/archives/python-%{docver}%{?prerel}-docs-html.tar.bz2
199
200 # A simple script to check timestamps of bytecode files
201 # Run in check section with Python that is currently being built
202 # Originally written by bkabrda
203 Source8: check-pyc-timestamps.py
204
205 #
206 # Upstream patches
207 #
208
209 #
210 # Fedora patches
211 #
212
213 # 00001 #
214 # Fixup distutils/unixccompiler.py to remove standard library path from rpath:
215 # Was Patch0 in ivazquez' python3000 specfile:
216 Patch101: 00001-rpath.patch
217
218 # 00102 #
219 # Change the various install paths to use /usr/lib64/ instead or /usr/lib
220 # Only used when "%%{_lib}" == "lib64"
221 # Not yet sent upstream.
222 Patch102: 00102-lib64.patch
223
224 # 00111 #
225 # Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
226 # a libpythonMAJOR.MINOR.a
227 # See https://bugzilla.redhat.com/show_bug.cgi?id=556092
228 # Downstream only: not appropriate for upstream
229 Patch111: 00111-no-static-lib.patch
230
231 # 00189 #
232 # Instead of bundled wheels, use our RPM packaged wheels from
233 # /usr/share/python-wheels
234 # Downstream only: upstream bundles
235 # We might eventually pursuit upstream support, but it's low prio
236 Patch189: 00189-use-rpm-wheels.patch
237
238 # 00251
239 # Set values of prefix and exec_prefix in distutils install command
240 # to /usr/local if executable is /usr/bin/python* and RPM build
241 # is not detected to make pip and distutils install into separate location
242 # Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
243 # Downstream only: Awaiting resources to work on upstream PEP
244 Patch251: 00251-change-user-install-location.patch
245
246 # 00274 #
247 # Upstream uses Debian-style architecture naming. Change to match Fedora.
248 Patch274: 00274-fix-arch-names.patch
249
250 # 00328 #
251 # Restore pyc to TIMESTAMP invalidation mode as default in rpmbubild
252 # See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
253 # Downstream only: only used when building RPM packages
254 # Ideally, we should talk to upstream and explain why we don't want this
255 Patch328: 00328-pyc-timestamp-invalidation-mode.patch
256
257 # 00357 # 4501d419207a7209831ae7e98b60c93df24d6519
258 # bpo-42938: Replace snprintf with Python unicode formatting in ctypes param reprs. (GH-24248)
259 # CVE-2021-3177
260 Patch357: 00357-bpo-42938-replace-snprintf-with-python-unicode-formatting-in-ctypes-param-reprs-gh-24248.patch
261
262 # (New patches go here ^^^)
263 #
264 # Mageia patches
265 #
266 Patch500: python3-3.7.1-module-linkage.patch
267 Patch501: python3-3.5.2-skip-distutils-tests-that-fail-in-rpmbuild.patch
268 Patch502: python3-3.7.1-uid-gid-overflows.patch
269 Patch503: python3-3.5.2-dont-raise-from-py_compile.patch
270 Patch506: python3-3.6.2-python3-config-LIBPLUSED-cmp0004-error.patch
271 Patch507: link-C-modules-with-libpython.patch
272
273 Provides: python(abi) = %{pybasever}
274 Provides: /usr/bin/python%{LDVERSION_optimized}
275 Provides: /usr/bin/python%{pybasever}
276 Requires: python-rpm-macros >= 3-8
277 Requires: python3-rpm-macros >= 3-8
278
279 # ease upgrade mga7->mga8, see mga#27857
280 Conflicts: python < 2.7.18-5
281 Conflicts: %{_lib}python3-devel < 3.8.1
282 Requires: %{lib_name} = %{version}-%{release}
283
284 %description
285 Python is an interpreted, interactive, object-oriented programming
286 language often compared to Tcl, Perl, Scheme or Java. Python includes
287 modules, classes, exceptions, very high level dynamic data types and
288 dynamic typing. Python supports interfaces to many system calls and
289 libraries, as well as to various windowing systems (X11, Motif, Tk,
290 Mac and MFC).
291
292 Programmers can write new built-in modules for Python in C or C++.
293 Python can be used as an extension language for applications that
294 need a programmable interface. This package contains most of the
295 standard Python modules, as well as modules for interfacing to the
296 Tix widget set for Tk and RPM.
297
298 Note that documentation for Python is provided in the python-docs
299 package.
300
301 %package -n %{lib_name}
302 Summary: Shared libraries for Python %{version}
303 Group: System/Libraries
304 Requires: %{lib_name}-stdlib = %{version}-%{release}
305
306 %description -n %{lib_name}
307 This packages contains Python shared object library. Python is an
308 interpreted, interactive, object-oriented programming language often
309 compared to Tcl, Perl, Scheme or Java.
310
311 %package -n %{lib_name}-stdlib
312 Summary: Python %{version} standard library
313 Group: Development/Python
314 %if %{with rpmwheels}
315 Requires: python-setuptools-wheel
316 Requires: python-pip-wheel
317 %else
318 Provides: bundled(python3-pip) = %{pip_version}
319 Provides: bundled(python3-setuptools) = %{setuptools_version}
320 %endif
321
322 %description -n %{lib_name}-stdlib
323 This package contains Python 3's standard library.
324 It is normally not used on its own, but as a dependency of Python %{version}.
325
326 %package -n %{lib_name}-testsuite
327 Summary: Testsuite for the Python %{version} standard library
328 Group: Development/Python
329 Provides: python3-testsuite = %{version}-%{release}
330 Requires: %{lib_name}-stdlib = %{version}-%{release}
331 Requires: %{lib_name} = %{version}-%{release}
332 Recommends: tkinter3
333
334 %description -n %{lib_name}-testsuite
335 The complete testsuite for the Python standard library.
336 It is normally not used on its own, but as a dependency of Python %{version}.
337
338 %package -n %{develname}
339 Summary: The libraries and header files needed for Python development
340 Group: Development/Python
341 Requires: %{name} = %{version}-%{release}
342 Requires: %{lib_name} = %{version}-%{release}
343 Provides: %{name}-devel = %{version}-%{release}
344 Provides: %{lib_name_orig}-devel = %{version}-%{release}
345 Conflicts: %{_lib}python-devel < 2.7.17-2
346 Recommends: %{lib_name}-testsuite
347 Recommends: %{name}-docs
348
349 %description -n %{develname}
350 The Python programming language's interpreter can be extended with
351 dynamically loaded extensions and can be embedded in other programs.
352 This package contains the header files and libraries needed to do
353 these types of tasks.
354
355 Install %{develname} if you want to develop Python extensions. The
356 python package will also need to be installed. You'll probably also
357 want to install the python-docs package, which contains Python
358 documentation.
359
360 %package docs
361 Summary: Documentation for the Python programming language
362 Requires: %{name} >= %{version}
363 Requires: xdg-utils
364 Group: Development/Python
365 BuildArch: noarch
366
367 %description docs
368 The python-docs package contains documentation on the Python
369 programming language and interpreter. The documentation is provided
370 in ASCII text files and in LaTeX source files.
371
372 Install the python-docs package if you'd like to use the documentation
373 for the Python language.
374
375 %package -n tkinter3
376 Summary: A graphical user interface for the Python scripting language
377 Group: Development/Python
378 Requires: %{name} = %{version}-%{release}
379 Requires: tcl tk
380 Provides: python3-tkinter
381
382 %description -n tkinter3
383 The Tkinter (Tk interface) program is an graphical user interface for
384 the Python scripting language.
385
386 You should install the tkinter package if you'd like to use a graphical
387 user interface for Python programming.
388
389 %package -n tkinter3-apps
390 Summary: Various applications written using tkinter
391 Group: Development/Python
392 Requires: tkinter3
393
394 %description -n tkinter3-apps
395 Various applications written using tkinter
396
397 %prep
398 %setup -qn Python-%{version}%{?prerel}
399 # Remove all exe files to ensure we are not shipping prebuilt binaries
400 # note that those are only used to create Microsoft Windows installers
401 # and that functionality is broken on Linux anyway
402 find -name '*.exe' -print -delete
403
404 # Remove bundled libraries to ensure that we're using the system copy.
405 rm -r Modules/expat
406
407 # Upstream patches
408
409 # Fedora patches
410 %patch101 -p1
411
412 %if "%{_lib}" == "lib64"
413 %patch102 -p1
414 %endif
415 %patch111 -p1
416
417 %if %{with rpmwheels}
418 %patch189 -p1
419 rm Lib/ensurepip/_bundled/*.whl
420 %endif
421
422 %patch251 -p1
423 %patch274 -p1
424 %patch328 -p1
425 %patch357 -p1
426
427 # Mageia patches
428 #patch500 -p1
429 %patch501 -p1
430 %patch502 -p1
431 %patch503 -p1
432 %patch506 -p1
433 %patch507 -p1
434
435
436 # Remove files that should be generated by the build
437 # (This is after patching, so that we can use patches directly from upstream)
438 rm configure pyconfig.h.in
439
440 # drop Autoconf version requirement
441 sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac
442
443 # docs
444 mkdir html
445 bzcat %{SOURCE1} | tar x -C html
446
447 find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@'
448
449 %build
450 autoreconf -vfi
451
452 # Remove -Wl,--no-undefined in accordance with MGA #9395 :
453 # https://bugs.mageia.org/show_bug.cgi?id=9395
454 %define _disable_ld_no_undefined 1
455
456 # Get proper option names from bconds
457 %if %{with computed_gotos}
458 %global computed_gotos_flag yes
459 %else
460 %global computed_gotos_flag no
461 %endif
462
463 %if %{with optimizations}
464 %global optimizations_flag "--enable-optimizations"
465 %else
466 %global optimizations_flag "--disable-optimizations"
467 %endif
468
469 export CFLAGS="%{optflags} -D_GNU_SOURCE -fPIC -fwrapv"
470 export CFLAGS_NODIST="%{optflags} -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition"
471 export CXXFLAGS="%{optflags} -D_GNU_SOURCE -fPIC -fwrapv"
472 export OPT="%{optflags} -D_GNU_SOURCE -fPIC -fwrapv"
473 export LINKCC="gcc"
474 export LDFLAGS="%{ldflags}"
475 export LDFLAGS_NODIST="%{ldflags} -fno-semantic-interposition"
476
477 %configure --host='' \
478 --enable-ipv6 \
479 --enable-shared \
480 --with-computed-gotos=%{computed_gotos_flag} \
481 --with-dbmliborder=gdbm:ndbm:bdb \
482 --with-system-expat \
483 --with-system-ffi \
484 --enable-loadable-sqlite-extensions \
485 --with-dtrace \
486 --with-lto \
487 --with-ssl-default-suites=openssl \
488 %if %{with valgrind}
489 --with-valgrind \
490 %endif
491 --with-threads \
492 --without-ensurepip \
493 %{optimizations_flag}
494
495 # (misc) if the home is nfs mounted, rmdir fails due to delay
496 export TMP="/tmp" TMPDIR="/tmp"
497
498 %if %{without bootstrap}
499 # Regenerate generated files (needs python3)
500 %make_build regen-all PYTHON_FOR_REGEN="python%{pybasever}"
501 %endif
502
503 %make_build EXTRA_CFLAGS="$CFLAGS" LN="ln -sf"
504
505 %install
506
507 %if %{with gdb_hooks}
508 DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}
509 mkdir -p %{buildroot}$DirHoldingGdbPy
510 %endif # with gdb_hooks
511
512 # fix Makefile to get rid of reference to distcc
513 perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile
514
515 # set the install path
516 echo '[install_scripts]' >setup.cfg
517 echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
518
519 %make_install LN="ln -sf"
520
521 %if %{with gdb_hooks}
522 # See comment on $DirHoldingGdbPy above
523 PathOfGdbPy=$DirHoldingGdbPy/libpython%{pybasever}%{ABIFLAGS_optimized}-%{version}-%{release}.%{_arch}.debug-gdb.py
524 cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy
525 %endif # with gdb_hooks
526
527 # Install directories for additional packages
528 install -d -m 0755 %{buildroot}%{pylibdir}/site-packages/__pycache__
529 %if "%{_lib}" == "lib64"
530 # The 64-bit version needs to create "site-packages" in /usr/lib/ (for
531 # pure-Python modules) as well as in /usr/lib64/ (for packages with extension
532 # modules).
533 # Note that rpmlint will complain about hardcoded library path;
534 # this is intentional.
535 install -d -m 0755 %{buildroot}%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__
536 %endif
537
538 # overwrite the copied binary with a link
539 pushd %{buildroot}%{_bindir}
540 #ln -sf python%{LDVERSION_optimized} python%{pybasever}
541 ln -sf python%{pybasever} python%{familyver}
542 popd
543
544 pushd %{buildroot}%{_libdir}
545 ln -sf $(ls libpython%{lib_major}*.so.*) libpython%{lib_major}.so
546 popd
547
548 # make python3 as default one
549 ln -s ./python3 %{buildroot}%{_bindir}/python
550 ln -s ./pydoc3 %{buildroot}%{_bindir}/pydoc
551 ln -s ./pygettext3.py %{buildroot}%{_bindir}/pygettext.py
552 ln -s ./msgfmt3.py %{buildroot}%{_bindir}/msgfmt.py
553 ln -s ./python3-config %{buildroot}%{_bindir}/python-config
554 ln -s ./python3.1 %{buildroot}%{_mandir}/man1/python.1
555 ln -s ./python3.pc %{buildroot}%{_libdir}/pkgconfig/python.pc
556
557 # install pynche as pynche3
558 cat << EOF > %{buildroot}%{_bindir}/pynche3
559 #!/usr/bin/bash
560 exec %{_libdir}/python%{pybasever}/site-packages/pynche/pynche
561 EOF
562 rm -f Tools/pynche/*.pyw
563 cp -r Tools/pynche %{buildroot}%{_libdir}/python%{pybasever}/site-packages/
564
565 chmod 755 %{buildroot}%{_bindir}/{idle3,pynche3}
566
567 ln -f Tools/pynche/README Tools/pynche/README.pynche
568
569 %if %{with valgrind}
570 install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-python3.supp
571 %endif
572
573 mkdir -p %{buildroot}%{_datadir}/applications
574 cat > %{buildroot}%{_datadir}/applications/%{_real_vendor}-tkinter3.desktop << EOF
575 [Desktop Entry]
576 Name=IDLE
577 Comment=IDE for Python3
578 Exec=%{_bindir}/idle3
579 Icon=development_environment_section
580 Terminal=false
581 Type=Application
582 Categories=Development;IDE;
583 EOF
584
585 cat > %{buildroot}%{_datadir}/applications/%{_real_vendor}-%{name}-docs.desktop << EOF
586 [Desktop Entry]
587 Name=Python documentation
588 Comment=Python complete reference
589 Exec=%{_bindir}/xdg-open %_defaultdocdir/%{name}-docs/index.html
590 Icon=documentation_section
591 Terminal=false
592 Type=Application
593 Categories=Documentation;
594 EOF
595
596 # fix non real scripts
597 #chmod 644 %{buildroot}%{_libdir}/python*/test/test_{binascii,grp,htmlparser}.py*
598 find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" -o -name "test_htmlparser.py*" \) -exec chmod 644 {} \;
599
600 # fix python library not stripped
601 chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 $RPM_BUILD_ROOT%{_libdir}/libpython3.so
602
603 # Make python3-devel multilib-ready
604 mv %{buildroot}%{_includedir}/python%{LDVERSION_optimized}/pyconfig.h \
605 %{buildroot}%{_includedir}/python%{LDVERSION_optimized}/pyconfig-%{__isa_bits}.h
606 cat > %{buildroot}%{_includedir}/python%{LDVERSION_optimized}/pyconfig.h << EOF
607 #include <bits/wordsize.h>
608
609 #if __WORDSIZE == 32
610 #include "pyconfig-32.h"
611 #elif __WORDSIZE == 64
612 #include "pyconfig-64.h"
613 #else
614 #error "Unknown word size"
615 #endif
616 EOF
617
618 # Make sure distutils looks at the right pyconfig.h file
619 # See https://bugzilla.redhat.com/show_bug.cgi?id=201434
620 # Similar for sysconfig: sysconfig.get_config_h_filename tries to locate
621 # pyconfig.h so it can be parsed, and needs to do this at runtime in site.py
622 # when python starts up (see https://bugzilla.redhat.com/show_bug.cgi?id=653058)
623 #
624 # Split this out so it goes directly to the pyconfig-32.h/pyconfig-64.h
625 # variants:
626 sed -i -e "s/'pyconfig.h'/'pyconfig-%{__isa_bits}.h'/" \
627 %{buildroot}%{pylibdir}/distutils/sysconfig.py \
628 %{buildroot}%{pylibdir}/sysconfig.py
629
630 # Install pathfix.py to bindir
631 # See https://github.com/fedora-python/python-rpm-porting/issues/24
632 cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/
633
634 # Install i18n tools to bindir
635 # They are also in python2, so we version them
636 # https://bugzilla.redhat.com/show_bug.cgi?id=1571474
637 for tool in pygettext msgfmt; do
638 cp -p Tools/i18n/${tool}.py %{buildroot}%{_bindir}/${tool}%{pybasever}.py
639 ln -s ${tool}%{pybasever}.py %{buildroot}%{_bindir}/${tool}3.py
640 done
641
642 # Switch all shebangs to refer to the specific Python version.
643 # This currently only covers files matching ^[a-zA-Z0-9_]+\.py$,
644 # so handle files named using other naming scheme separately.
645 LD_LIBRARY_PATH=./ ./python \
646 Tools/scripts/pathfix.py \
647 -i "%{_bindir}/python%{pybasever}" -pn \
648 %{buildroot} \
649 %{buildroot}%{_bindir}/*%{pybasever}.py \
650 %{buildroot}%{_libdir}/python%{pybasever}/site-packages/pynche/pynche \
651 %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}
652
653 # Remove shebang lines from .py files that aren't executable, and
654 # remove executability from .py files that don't have a shebang line:
655 find %{buildroot} -name \*.py \
656 \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \
657 -print -exec sed -i '1d' {} \; \) -o \( \
658 -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
659 -exec chmod a-x {} \; \) \)
660
661 # Get rid of DOS batch files:
662 find %{buildroot} -name \*.bat -exec rm {} \;
663
664 # Get rid of backup files:
665 find %{buildroot}/ -name "*~" -exec rm -f {} \;
666 find . -name "*~" -exec rm -f {} \;
667
668 # Get rid of a stray copy of the license:
669 rm -f %{buildroot}%{pylibdir}/LICENSE.txt
670
671 # Do bytecompilation with the newly installed interpreter.
672 # This is similar to the script in macros.pybytecompile
673 # compile *.pyc
674 find %{buildroot}%{_libdir}/python%{pybasever} -type f -a -name "*.py" -print0 | \
675 LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
676 PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
677 xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2], optimize=opt) for opt in range(3) for f in sys.argv[1:]]' || :
678
679 # Since we have pathfix.py in bindir, this is created, but we don't want it
680 rm -rf %{buildroot}%{_bindir}/__pycache__
681
682 # Fixup permissions for shared libraries from non-standard 555 to standard 755:
683 find %{buildroot} -perm 555 -exec chmod 755 {} \;
684
685 # make man python3.Xm work https://bugzilla.redhat.com/show_bug.cgi?id=1612241
686 ln -s ./python%{pybasever}.1 %{buildroot}%{_mandir}/man1/python%{pybasever}m.1
687
688 %if %{with tests}
689 %check
690 # (misc) if the home is nfs mounted, rmdir fails
691 export TMP="/tmp" TMPDIR="/tmp"
692
693 # Exclude some tests that hangs on the BS
694 EXCLUDE="test_ssl test_socket test_epoll"
695 %ifarch x86_64
696 EXCLUDE="$EXCLUDE test_faulthandler"
697 %endif
698 %ifarch %arm
699 EXCLUDE="$EXCLUDE test_float test_asyncio test_cmath"
700 %endif
701 # Local aarch64 tests succeeds, but fails on BS
702 %ifarch aarch64
703 EXCLUDE="$EXCLUDE test_posix test_asyncio test_openpty test_os test_pty test_readline"
704 %endif
705 # json test pass on local build but fail on BS
706 EXCLUDE="$EXCLUDE test_json"
707 # to investigate why it fails on local build
708 EXCLUDE="$EXCLUDE test_site"
709 # why this fails?
710 EXCLUDE="$EXCLUDE test_distutils"
711 # failing with 3.8RC1:
712 EXCLUDE="$EXCLUDE test___all__ test_embed test_mmap test_os"
713 # all tests must pass
714 # but we disable network on BS
715 WITHIN_PYTHON_RPM_BUILD= \
716 make test TESTOPTS="-wW --slowest -j0 -u none -x $EXCLUDE"
717 # consider use network on local build
718 #EXCLUDE=""
719 #WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u network -x $EXCLUDE"
720 %endif
721
722 %files
723 %{_bindir}/pathfix.py
724 %{_bindir}/pydoc
725 %{_bindir}/pydoc%{familyver}
726 %{_bindir}/pydoc%{pybasever}
727 %{_bindir}/python
728 %{_bindir}/python%{familyver}
729 %{_bindir}/python%{pybasever}
730 %{_bindir}/python%{LDVERSION_optimized}
731 %{_bindir}/2to3
732 %{_bindir}/2to3-%{pybasever}
733 %{_mandir}/man*/*
734
735 %files -n %{lib_name}-stdlib
736 %license LICENSE
737 %doc README.rst
738 %{_includedir}/python%{LDVERSION_optimized}/pyconfig-%{__isa_bits}.h
739 %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile
740 %if "%{_lib}" == "lib64"
741 %dir %{_prefix}/lib/python%{pybasever}
742 %dir %{_prefix}/lib/python%{pybasever}/site-packages
743 %dir %{_prefix}/lib/python%{pybasever}/site-packages/__pycache__/
744 %endif
745 %dir %{pylibdir}
746 %dir %{dynload_dir}
747 %dir %{site_packages}
748 %dir %{site_packages}/__pycache__/
749 %{site_packages}/README.txt
750 %{pylibdir}/*.py
751 %dir %{pylibdir}/__pycache__/
752 %{pylibdir}/__pycache__/*%{bytecode_suffixes}
753
754 %dir %{pylibdir}/unittest/
755 %dir %{pylibdir}/unittest/__pycache__/
756 %{pylibdir}/unittest/*.py
757 %{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes}
758
759 %dir %{pylibdir}/asyncio/
760 %dir %{pylibdir}/asyncio/__pycache__/
761 %{pylibdir}/asyncio/*.py
762 %{pylibdir}/asyncio/__pycache__/*%{bytecode_suffixes}
763
764 %dir %{pylibdir}/venv/
765 %dir %{pylibdir}/venv/__pycache__/
766 %{pylibdir}/venv/*.py
767 %{pylibdir}/venv/__pycache__/*%{bytecode_suffixes}
768 %{pylibdir}/venv/scripts
769
770 %{pylibdir}/wsgiref
771 %{pylibdir}/xml
772 %{pylibdir}/xmlrpc
773
774 %dir %{pylibdir}/ensurepip/
775 %dir %{pylibdir}/ensurepip/__pycache__/
776 %{pylibdir}/ensurepip/*.py
777 %{pylibdir}/ensurepip/__pycache__/*%{bytecode_suffixes}
778
779 %if %{with rpmwheels}
780 %exclude %{pylibdir}/ensurepip/_bundled
781 %else
782 %dir %{pylibdir}/ensurepip/_bundled
783 %{pylibdir}/ensurepip/_bundled/*.whl
784 %endif
785
786 %dir %{pylibdir}/concurrent/
787 %dir %{pylibdir}/concurrent/__pycache__/
788 %{pylibdir}/concurrent/*.py
789 %{pylibdir}/concurrent/__pycache__/*%{bytecode_suffixes}
790
791 %dir %{pylibdir}/concurrent/futures/
792 %dir %{pylibdir}/concurrent/futures/__pycache__/
793 %{pylibdir}/concurrent/futures/*.py
794 %{pylibdir}/concurrent/futures/__pycache__/*%{bytecode_suffixes}
795
796 %{pylibdir}/pydoc_data
797
798 %dir %{pylibdir}/collections/
799 %dir %{pylibdir}/collections/__pycache__/
800 %{pylibdir}/collections/*.py
801 %{pylibdir}/collections/__pycache__/*%{bytecode_suffixes}
802
803 %dir %{pylibdir}/ctypes/
804 %dir %{pylibdir}/ctypes/__pycache__/
805 %{pylibdir}/ctypes/*.py
806 %{pylibdir}/ctypes/__pycache__/*%{bytecode_suffixes}
807 %{pylibdir}/ctypes/macholib
808
809 %{pylibdir}/curses
810
811 %dir %{pylibdir}/dbm/
812 %dir %{pylibdir}/dbm/__pycache__/
813 %{pylibdir}/dbm/*.py
814 %{pylibdir}/dbm/__pycache__/*%{bytecode_suffixes}
815
816 %dir %{pylibdir}/distutils/
817 %dir %{pylibdir}/distutils/__pycache__/
818 %{pylibdir}/distutils/*.py
819 %{pylibdir}/distutils/__pycache__/*%{bytecode_suffixes}
820 %{pylibdir}/distutils/README
821 %{pylibdir}/distutils/command
822
823 %dir %{pylibdir}/email/
824 %dir %{pylibdir}/email/__pycache__/
825 %{pylibdir}/email/*.py
826 %{pylibdir}/email/__pycache__/*%{bytecode_suffixes}
827 %{pylibdir}/email/mime
828 %doc %{pylibdir}/email/architecture.rst
829
830 %{pylibdir}/encodings
831
832 %{pylibdir}/html
833 %{pylibdir}/http
834
835 %dir %{pylibdir}/importlib/
836 %dir %{pylibdir}/importlib/__pycache__/
837 %{pylibdir}/importlib/*.py
838 %{pylibdir}/importlib/__pycache__/*%{bytecode_suffixes}
839
840 %dir %{pylibdir}/json/
841 %dir %{pylibdir}/json/__pycache__/
842 %{pylibdir}/json/*.py
843 %{pylibdir}/json/__pycache__/*%{bytecode_suffixes}
844
845 %{pylibdir}/lib2to3
846 %exclude %{pylibdir}/lib2to3/tests
847
848 %{pylibdir}/logging
849 %{pylibdir}/multiprocessing
850
851 %dir %{pylibdir}/sqlite3/
852 %dir %{pylibdir}/sqlite3/__pycache__/
853 %{pylibdir}/sqlite3/*.py
854 %{pylibdir}/sqlite3/__pycache__/*%{bytecode_suffixes}
855
856 %exclude %{pylibdir}/turtle.py
857 %exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
858
859 %{pylibdir}/urllib
860
861 %{dynload_dir}/_bisect.%{SOABI_optimized}.so
862 %{dynload_dir}/_bz2.%{SOABI_optimized}.so
863 %{dynload_dir}/_codecs_cn.%{SOABI_optimized}.so
864 %{dynload_dir}/_codecs_hk.%{SOABI_optimized}.so
865 %{dynload_dir}/_codecs_iso2022.%{SOABI_optimized}.so
866 %{dynload_dir}/_codecs_jp.%{SOABI_optimized}.so
867 %{dynload_dir}/_codecs_kr.%{SOABI_optimized}.so
868 %{dynload_dir}/_codecs_tw.%{SOABI_optimized}.so
869 %{dynload_dir}/_contextvars.%{SOABI_optimized}.so
870 %{dynload_dir}/_crypt.%{SOABI_optimized}.so
871 %{dynload_dir}/_csv.%{SOABI_optimized}.so
872 %{dynload_dir}/_ctypes.%{SOABI_optimized}.so
873 %{dynload_dir}/_curses.%{SOABI_optimized}.so
874 %{dynload_dir}/_curses_panel.%{SOABI_optimized}.so
875 %{dynload_dir}/_dbm.%{SOABI_optimized}.so
876 %{dynload_dir}/_decimal.%{SOABI_optimized}.so
877 %{dynload_dir}/_elementtree.%{SOABI_optimized}.so
878 %{dynload_dir}/_gdbm.%{SOABI_optimized}.so
879 %{dynload_dir}/_hashlib.%{SOABI_optimized}.so
880 %{dynload_dir}/_heapq.%{SOABI_optimized}.so
881 %{dynload_dir}/_json.%{SOABI_optimized}.so
882 %{dynload_dir}/_lsprof.%{SOABI_optimized}.so
883 %{dynload_dir}/_lzma.%{SOABI_optimized}.so
884 %{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so
885 %{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so
886 %{dynload_dir}/_opcode.%{SOABI_optimized}.so
887 %{dynload_dir}/_pickle.%{SOABI_optimized}.so
888 %{dynload_dir}/_posixshmem.%{SOABI_optimized}.so
889 %{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
890 %{dynload_dir}/_queue.%{SOABI_optimized}.so
891 %{dynload_dir}/_random.%{SOABI_optimized}.so
892 %{dynload_dir}/_socket.%{SOABI_optimized}.so
893 %{dynload_dir}/_sqlite3.%{SOABI_optimized}.so
894 %{dynload_dir}/_statistics.%{SOABI_optimized}.so
895 %{dynload_dir}/_ssl.%{SOABI_optimized}.so
896 %{dynload_dir}/_struct.%{SOABI_optimized}.so
897 %{dynload_dir}/_md5.%{SOABI_optimized}.so
898 %{dynload_dir}/_sha1.%{SOABI_optimized}.so
899 %{dynload_dir}/_sha256.%{SOABI_optimized}.so
900 %{dynload_dir}/_sha512.%{SOABI_optimized}.so
901 %{dynload_dir}/_xxsubinterpreters.%{SOABI_optimized}.so
902 %{dynload_dir}/array.%{SOABI_optimized}.so
903 %{dynload_dir}/audioop.%{SOABI_optimized}.so
904 %{dynload_dir}/binascii.%{SOABI_optimized}.so
905 %{dynload_dir}/cmath.%{SOABI_optimized}.so
906 %{dynload_dir}/_datetime.%{SOABI_optimized}.so
907 %{dynload_dir}/fcntl.%{SOABI_optimized}.so
908 %{dynload_dir}/grp.%{SOABI_optimized}.so
909 %{dynload_dir}/math.%{SOABI_optimized}.so
910 %{dynload_dir}/mmap.%{SOABI_optimized}.so
911 %{dynload_dir}/nis.%{SOABI_optimized}.so
912 %{dynload_dir}/ossaudiodev.%{SOABI_optimized}.so
913 %{dynload_dir}/parser.%{SOABI_optimized}.so
914 %{dynload_dir}/pyexpat.%{SOABI_optimized}.so
915 %{dynload_dir}/readline.%{SOABI_optimized}.so
916 %{dynload_dir}/resource.%{SOABI_optimized}.so
917 %{dynload_dir}/select.%{SOABI_optimized}.so
918 %{dynload_dir}/spwd.%{SOABI_optimized}.so
919 %{dynload_dir}/syslog.%{SOABI_optimized}.so
920 %{dynload_dir}/termios.%{SOABI_optimized}.so
921 %{dynload_dir}/unicodedata.%{SOABI_optimized}.so
922 %{dynload_dir}/_uuid.%{SOABI_optimized}.so
923 %{dynload_dir}/xxlimited.%{SOABI_optimized}.so
924 %{dynload_dir}/zlib.%{SOABI_optimized}.so
925 %{dynload_dir}/_asyncio.%{SOABI_optimized}.so
926 %{dynload_dir}/_blake2.%{SOABI_optimized}.so
927 %{dynload_dir}/_sha3.%{SOABI_optimized}.so
928
929 %files -n %{lib_name}-testsuite
930 %{pylibdir}/ctypes/test
931 %{pylibdir}/distutils/tests
932 %{pylibdir}/lib2to3/tests
933 %{pylibdir}/sqlite3/test
934 %{pylibdir}/test/
935 %{pylibdir}/unittest/test
936 # These two are shipped in the main subpackage:
937 %exclude %{pylibdir}/test/test_support.py*
938 %exclude %{pylibdir}/test/__init__.py*
939 %{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so
940 %{dynload_dir}/_testcapi.%{SOABI_optimized}.so
941 %{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
942 %{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so
943 %{dynload_dir}/_testinternalcapi.%{SOABI_optimized}.so
944 %{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so
945 %{dynload_dir}/_xxtestfuzz.%{SOABI_optimized}.so
946
947 %files -n %{lib_name}
948 %{_libdir}/libpython%{LDVERSION_optimized}.so.1*
949
950 %files -n %{develname}
951 %{_bindir}/pygettext.py
952 %{_bindir}/pygettext%{familyver}*.py
953
954 %{_bindir}/msgfmt.py
955 %{_bindir}/msgfmt%{familyver}*.py
956
957 %{_bindir}/python-config
958 %{_bindir}/python%{pybasever}-config
959 %{_bindir}/python%{LDVERSION_optimized}-config
960 %{_bindir}/python%{familyver}-config
961
962 %{_libdir}/libpython%{LDVERSION_optimized}.so
963 %{_libdir}/libpython%{pybasever}.so
964 %{_libdir}/libpython%{familyver}.so
965 %{_includedir}/python%{LDVERSION_optimized}
966 %exclude %{_includedir}/python%{LDVERSION_optimized}/pyconfig-%{__isa_bits}.h
967 %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}
968 %{_libdir}/pkgconfig/python.pc
969 %{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc
970 %{_libdir}/pkgconfig/python-%{pybasever}{,-embed}.pc
971 %{_libdir}/pkgconfig/python%{familyver}{,-embed}.pc
972
973 %exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile
974 %if %{with valgrind}
975 %{_libdir}/valgrind/valgrind-python3.supp
976 %endif
977
978 %files docs
979 %doc html/*/*
980 %{_datadir}/applications/%{_real_vendor}-%{name}-docs.desktop
981
982 %files -n tkinter3
983 %{pylibdir}/tkinter/
984 %{dynload_dir}/_tkinter.%{SOABI_optimized}.so
985 %{pylibdir}/idlelib
986 %{site_packages}/pynche
987 %{pylibdir}/turtle.py
988 %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
989 %dir %{pylibdir}/turtledemo
990 %{pylibdir}/turtledemo/*.py
991 %{pylibdir}/turtledemo/*.cfg
992 %dir %{pylibdir}/turtledemo/__pycache__/
993 %{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes}
994
995 %files -n tkinter3-apps
996 %{_bindir}/idle%{familyver}
997 %{_bindir}/idle%{pybasever}
998 %{_bindir}/pynche%{familyver}
999 %{_datadir}/applications/%{_real_vendor}-tkinter3.desktop
1000
1001 # We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from ldconfig
1002 # See https://bugzilla.redhat.com/show_bug.cgi?id=562980
1003 #
1004 # The /usr/lib/rpm/redhat/macros defines %%__debug_package to use
1005 # debugfiles.list, and it appears that everything below /usr/lib/debug and
1006 # (/usr/src/debug) gets added to this file (via LISTFILES) in
1007 # /usr/lib/rpm/find-debuginfo.sh
1008 #
1009 # Hence by installing it below /usr/lib/debug we ensure it is added to the
1010 # -debuginfo subpackage
1011 # (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
1012 # payload file would be unpackaged)
1013
1014 # Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1476593
1015 %undefine _debuginfo_subpackages

  ViewVC Help
Powered by ViewVC 1.1.30