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

  ViewVC Help
Powered by ViewVC 1.1.30