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

  ViewVC Help
Powered by ViewVC 1.1.30