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

  ViewVC Help
Powered by ViewVC 1.1.30