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

  ViewVC Help
Powered by ViewVC 1.1.30