--- python3/python3.spec 2017-10-04 11:59:06.379211729 +0200 +++ python36/python36.spec 2017-10-05 12:05:49.804791303 +0200 @@ -2,19 +2,22 @@ # Top-level metadata # ================== -Name: python3 -Summary: Interpreter of the Python programming language -URL: https://www.python.org/ - %global pybasever 3.6 - # pybasever without the dot: %global pyshortver 36 +%global pip_version 9.0.1 +%global setuptools_version 36.2.0 + +Name: python%{pyshortver} +Summary: Version %{pybasever} of the Python programming language +URL: https://www.python.org/ + + # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.2 -Release: 19%{?dist} +Release: 1%{?dist} License: Python @@ -65,45 +68,6 @@ %endif -# ================================== -# Notes from bootstraping Python 3.6 -# ================================== -# -# New Python major version (3.X) break ABI and bytecode compatibility, -# so all packages depending on it need to be rebuilt. -# -# Due to a dependency cycle between Python, gdb, rpm, pip, setuptools, wheel, -# and other packages, this isn't straightforward. -# Build in the following order: -# -# 1. At the same time: -# - gdb without python support (add %%global _without_python 1 on top of -# gdb's SPEC file) -# - python-rpm-generators with bootstrapping_python set to 1 -# (this can be done also during step 2., but should be done before 3.) -# 2. python3 without rewheel (use %%bcond_with rewheel instead of -# %%bcond_without) -# 3. At the same time: -# - gdb with python support (remove %%global _without_python 1 on top of -# gdb's SPEC file) -# - python-rpm-generators with bootstrapping_python set to 0 -# (this can be done at any later step without negative effects) -# 4. rpm -# 5. python-setuptools with bootstrap set to 1 -# 6. python-pip with build_wheel set to 0 -# 7. python-wheel with %%bcond_without bootstrap -# 8. python-setuptools with bootstrap set to 0 and also with_check set to 0 -# 9. python-pip with build_wheel set to 1 -# 10. pyparsing -# 11. python3 with rewheel -# -# Then the most important packages have to be built, in dependency order. -# These were: -# python-sphinx, pytest, python-requests, cloud-init, dnf, anaconda, abrt -# -# After these have been built, a targeted rebuild should be done for the rest. - - # ===================== # General global macros # ===================== @@ -149,6 +113,28 @@ # on files that test invalid syntax. %undefine py_auto_byte_compile +# Unfortunately, in EPEL7 this macro is not yet taken into account. +# We want to byte-compile the .py files within the packages using the new +# python3 binary. +# +# Unfortunately, rpmbuild's infrastructure requires us to jump through some +# hoops to avoid byte-compiling with the system python 2 version: +# /usr/lib/rpm/redhat/macros sets up build policy that (amongst other things) +# defines __os_install_post. In particular, "brp-python-bytecompile" is +# invoked without an argument thus using the wrong version of python +# (/usr/bin/python, rather than the freshly built python), thus leading to +# numerous syntax errors, and incorrect magic numbers in the .pyc files. We +# thus override __os_install_post to avoid invoking this script: +%global __os_install_post \ + /usr/lib/rpm/brp-compress \ + %{!?__debug_package:/usr/lib/rpm/brp-strip %{__strip}} \ + /usr/lib/rpm/brp-strip-static-archive %{__strip} \ + /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \ + /usr/lib/rpm/brp-python-hardlink +# to remove the invocation of brp-python-bytecompile, whilst keeping the +# invocation of brp-python-hardlink (since this should still work for python3 +# pyc/pyo files) + # For multilib support, files that are different between 32- and 64-bit arches # need different filenames. Use "64" or "32" according to the word size. # Currently, the best way to determine an architecture's word size happens to @@ -212,12 +198,7 @@ BuildRequires: /usr/bin/dtrace # workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig) -BuildRequires: /usr/sbin/ifconfig - -%if %{with rewheel} -BuildRequires: python3-setuptools -BuildRequires: python3-pip -%endif +BuildRequires: net-tools # ======================= @@ -249,15 +230,11 @@ # Written by bkabrda Source8: check-pyc-and-pyo-timestamps.py -# Backward compatible no-op macro for system-python -# Remove in Fedora 29 -Source9: macros.systempython - # Desktop menu entry for idle3 -Source10: idle3.desktop +Source10: idle%{pybasever}.desktop # AppData file for idle3 -Source11: idle3.appdata.xml +Source11: idle%{pybasever}.appdata.xml # 00001 # # Fixup distutils/unixccompiler.py to remove standard library path from rpath: @@ -395,6 +372,11 @@ # Upstream uses Debian-style architecture naming. Change to match Fedora. Patch274: 00274-fix-arch-names.patch +# 00300 # +# Disable a failing test when built in a container: +# https://bugs.python.org/issue31132 +Patch300: 00300-disable-failing-test.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -413,178 +395,25 @@ # depend on python(abi). Provide that here. Provides: python(abi) = %{pybasever} -# For backward compatibility only, remove in F29: -Provides: system-python(abi) = %{pybasever} -Provides: system-python = %{version}-%{release} -Provides: system-python%{?_isa} = %{version}-%{release} -Obsoletes: system-python < %{version}-%{release} - -Requires: %{name}-libs%{?_isa} = %{version}-%{release} - -# In order to support multiple Python interpreters for development purposes, -# packages with with the naming scheme pythonXY (e.g. python35) exist for -# non-default versions of Python 3. -# For consistency, and to keep the upgrade path clean, we Provide/Obsolete -# these names here. -Provides: python%{pyshortver} = %{version}-%{release} -# Note that using Obsoletes without package version is not standard practice. -# Here we assert that *any* version of the system's default interpreter is -# preferable to an "extra" interpreter. For example, python3-3.6.1 will -# replace python36-3.6.2. -Obsoletes: python%{pyshortver} - -%if %{with rewheel} -Requires: python3-setuptools -Requires: python3-pip -%endif +# We don't want to provide this +# No package in Fedora shall ever depend on this +#%%global __requires_exclude ^python\\(abi\\) = 3\\..$ +#%%global __provides_exclude ^python\\(abi\\) = 3\\..$ + +# We keep those inside on purpose +#Provides: bundled(python3-pip) = %{pip_version} +#Provides: bundled(python3-setuptools) = %{setuptools_version} +Provides: bundled(python%{pyshortver}-pip) = %{pip_version} +Provides: bundled(python%{pyshortver}-setuptools) = %{setuptools_version} # The description used both for the SRPM and the main `python3` subpackage: %description -Python is an accessible, high-level, dynamically typed, interpreted programming -language, designed with an emphasis on code readibility. -It includes an extensive standard library, and has a vast ecosystem of -third-party libraries. - -The ${name} package provides the "python3" executable: the reference -interpreter for the Python language, version 3. -The majority of its standard library is provided in the %{name}-libs package, -which should be installed automatically along with %{name}. -The remaining parts of the Python standard library are broken out into the -%{name}-tkinter and %{name}-test packages, which may need to be installed -separately. - -Documentation for Python is provided in the %{name}-docs package. - -Packages containing additional libraries for Python are generally named with -the "%{name}-" prefix. - - -%package libs -Summary: Python runtime libraries - -# The "enum" module is included in the standard library. -# Provide an upgrade path from the external library. -Provides: python3-enum34 = 1.0.4-5%{?dist} -Obsoletes: python3-enum34 < 1.0.4-5%{?dist} - -# Python 3 built with glibc >= 2.24.90-26 needs to require it -# See https://bugzilla.redhat.com/show_bug.cgi?id=1410644 -Requires: glibc%{?_isa} >= 2.24.90-26 - -# For backward compatibility only, remove in F29: -Provides: system-python-libs = %{version}-%{release} -Provides: system-python-libs%{?_isa} = %{version}-%{release} -Obsoletes: system-python-libs < %{version}-%{release} - -%description libs -This package contains runtime libraries for use by Python: -- the majority of the Python standard library -- a dynamically linked library for use by applications that embed Python as - a scripting language, and by the main "python3" executable - +Python %{pybasever} package for developers. -%package devel -Summary: Libraries and header files needed for Python development -Requires: %{name} = %{version}-%{release} -Requires: %{name}-libs%{?_isa} = %{version}-%{release} -BuildRequires: python-rpm-macros -Requires: python-rpm-macros -Requires: python3-rpm-macros -Requires: python3-rpm-generators - -# https://bugzilla.redhat.com/show_bug.cgi?id=1217376 -# https://bugzilla.redhat.com/show_bug.cgi?id=1496757 -# https://bugzilla.redhat.com/show_bug.cgi?id=1218294 -# TODO change to a specific subpackage once available (#1218294) -Requires: redhat-rpm-config - -Conflicts: %{name} < %{version}-%{release} - -%description devel -This package contains the header files and configuration needed to compile -Python extension modules (typically written in C or C++), to embed Python -into other programs, and to make binary distributions for Python libraries. - -It also contains the necessary macros to build RPM packages with Python modules. - - -%package tools -Summary: A collection of tools included with Python including 2to3 and idle -Requires: %{name} = %{version}-%{release} -Requires: %{name}-tkinter = %{version}-%{release} - -Provides: %{name}-2to3 = %{version}-%{release} -Provides: %{name}-idle = %{version}-%{release} -Provides: 2to3 = %{version}-%{release} -Provides: idle3 = %{version}-%{release} - -# https://bugzilla.redhat.com/show_bug.cgi?id=1111275 -# /usr/bin/2to3 was moved from here -# TODO Remove in Fedora 29 -Conflicts: python2-tools < 2.7.13-17 -Conflicts: python-tools < 2.7.13-17 - -%description tools -This package contains several tools included with Python, including: -- 2to3, an automatic source converter from Python 2.X -- idle, a basic graphical development environment - - -%package tkinter -Summary: A GUI toolkit for Python -Requires: %{name} = %{version}-%{release} - -%description tkinter -The Tkinter (Tk interface) library is a graphical user interface toolkit for -the Python programming language. - - -%package test -Summary: The self-test suite for the main python3 package -Requires: %{name} = %{version}-%{release} -Requires: %{name}-tools = %{version}-%{release} - - -%description test -The self-test suite for the Python interpreter. - -This is only useful to test Python itself. For testing general Python code, -you should use the unittest module from %{name}-libs, or a library such as -${name}-pytest or ${name}-nose. - - -%if %{with debug_build} -%package debug -Summary: Debug version of the Python runtime - -# The debug build is an all-in-one package version of the regular build, and -# shares the same .py/.pyc files and directories as the regular build. Hence -# we depend on all of the subpackages of the regular build: -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: %{name}-libs%{?_isa} = %{version}-%{release} -Requires: %{name}-devel%{?_isa} = %{version}-%{release} -Requires: %{name}-test%{?_isa} = %{version}-%{release} -Requires: %{name}-tkinter%{?_isa} = %{version}-%{release} -Requires: %{name}-tools%{?_isa} = %{version}-%{release} - -%description debug -python3-debug provides a version of the Python runtime with numerous debugging -features enabled, aimed at advanced Python users such as developers of Python -extension modules. - -This version uses more memory and will be slower than the regular Python build, -but is useful for tracking down reference-counting issues and other bugs. - -The bytecode format is unchanged, so that .pyc files are compatible between -this and the standard version of Python, but the debugging features mean that -C/C++ extension modules are ABI-incompatible and must be built for each version -separately. - -The debug build shares installation directories with the standard Python -runtime, so that .py and .pyc files can be shared. -Compiled extension modules use a special ABI flag ("d") in the filename, -so extensions for both verisons can co-exist in the same directory. -%endif # with debug_build +This package exists to allow developers to test their code against an older or +more recent version of Python. This is not a full Python stack and if you wish +to run your applications with Python %{pybasever}, see other distributions that +support it, such as CentOS or RHEL with Software Collections. # ====================================================== @@ -605,7 +434,6 @@ rm -r Modules/zlib %if %{with rewheel} -%global pip_version 9.0.1 sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/ensurepip/__init__.py %endif @@ -647,6 +475,8 @@ %patch273 -p1 %patch274 -p1 +%patch300 -p0 + # Remove files that should be generated by the build # (This is after patching, so that we can use patches directly from upstream) @@ -716,7 +546,6 @@ --with-system-ffi \ --enable-loadable-sqlite-extensions \ --with-dtrace \ - --with-lto \ %if %{with systemtap} --with-systemtap \ %endif @@ -726,6 +555,9 @@ $ExtraConfigArgs \ %{nil} + # Does not build on EPEL + #--with-lto \ + # Invoke the build make EXTRA_CFLAGS="$CFLAGS $MoreCFlags" %{?_smp_mflags} @@ -883,15 +715,15 @@ %endif # add idle3 to menu -install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle3.png -install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle3.png -install -D -m 0644 Lib/idlelib/Icons/idle_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/idle3.png +install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle%{pybasever}.png +install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle%{pybasever}.png +install -D -m 0644 Lib/idlelib/Icons/idle_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/idle%{pybasever}.png desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10} # Install and validate appdata file mkdir -p %{buildroot}%{_datadir}/appdata cp -a %{SOURCE11} %{buildroot}%{_datadir}/appdata -appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/idle3.appdata.xml +appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/idle%{pybasever}.appdata.xml # Development tools install -m755 -d %{buildroot}%{pylibdir}/Tools @@ -976,21 +808,16 @@ # Install macros for rpm: mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/ install -m 644 %{SOURCE3} %{buildroot}/%{_rpmconfigdir}/macros.d/ -install -m 644 %{SOURCE9} %{buildroot}/%{_rpmconfigdir}/macros.d/ -# Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to -# avoid the user having to know the precise version and ABI flags. -# See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748 -%if %{with debug_build} -ln -s \ - %{_bindir}/python%{LDVERSION_debug} \ - %{buildroot}%{_bindir}/python3-debug -%endif - -# System Python: Link the executable to libexec -# This is for backwards compatibility only and should be removed in Fedora 29 -mkdir -p %{buildroot}%{_libexecdir} -ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/system-python +# Remove stuff that would conflict with the main python3 package +mv -v %{buildroot}%{_bindir}/python{3,%{pyshortver}} +mv -v %{buildroot}%{_bindir}/pathfix{,-%{pybasever}}.py +rm -v %{buildroot}%{_bindir}/*3 +rm -v %{buildroot}%{_bindir}/python3-* +rm -v %{buildroot}%{_bindir}/pyvenv +rm -v %{buildroot}%{_libdir}/libpython3.so +rm -v %{buildroot}%{_mandir}/man1/python3.1* +rm -v %{buildroot}%{_libdir}/pkgconfig/python3.pc # ====================================================== @@ -1090,14 +917,12 @@ # Scriptlets # ====================================================== -%post libs -p /sbin/ldconfig - -%postun libs -p /sbin/ldconfig - %post +/sbin/ldconfig /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : %postun +/sbin/ldconfig if [ $1 -eq 0 ] ; then /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : @@ -1110,20 +935,12 @@ %defattr(-, root, root) %license LICENSE %doc README.rst -%{_bindir}/pydoc* -%{_bindir}/python3 +%{_bindir}/pydoc%{pybasever} %{_bindir}/python%{pybasever} +%{_bindir}/python%{pyshortver} %{_bindir}/python%{pybasever}m -%{_bindir}/pyvenv %{_bindir}/pyvenv-%{pybasever} %{_mandir}/*/* -# Remove in Fedora 29: -%{_libexecdir}/system-python - -%files libs -%defattr(-,root,root,-) -%license LICENSE -%doc README.rst %dir %{pylibdir} %dir %{dynload_dir} @@ -1337,7 +1154,6 @@ %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h} %{_libdir}/%{py_INSTSONAME_optimized} -%{_libdir}/libpython3.so %if %{with systemtap} %dir %(dirname %{tapsetdir}) %dir %{tapsetdir} @@ -1345,39 +1161,33 @@ %doc systemtap-example.stp pyfuntop.stp %endif -%files devel -%defattr(-,root,root) +# devel %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/* %exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile %{pylibdir}/distutils/command/wininst-*.exe %{_includedir}/python%{LDVERSION_optimized}/*.h %exclude %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h} %doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit -%{_bindir}/python3-config %{_bindir}/python%{pybasever}-config %{_bindir}/python%{LDVERSION_optimized}-config %{_bindir}/python%{LDVERSION_optimized}-*-config -%{_bindir}/pathfix.py +%{_bindir}/pathfix-%{pybasever}.py %{_libdir}/libpython%{LDVERSION_optimized}.so %{_libdir}/pkgconfig/python-%{LDVERSION_optimized}.pc %{_libdir}/pkgconfig/python-%{pybasever}.pc -%{_libdir}/pkgconfig/python3.pc %{_rpmconfigdir}/macros.d/macros.pybytecompile%{pybasever} -%{_rpmconfigdir}/macros.d/macros.systempython -%files tools -%defattr(-,root,root,755) -%{_bindir}/2to3 +# tools # TODO: Remove 2to3-3.7 once rebased to 3.7 %{_bindir}/2to3-%{pybasever} -%{_bindir}/idle* +%{_bindir}/idle%{pybasever} %{pylibdir}/Tools %doc %{pylibdir}/Doc -%{_datadir}/appdata/idle3.appdata.xml -%{_datadir}/applications/idle3.desktop -%{_datadir}/icons/hicolor/*/apps/idle3.* +%{_datadir}/appdata/idle%{pybasever}.appdata.xml +%{_datadir}/applications/idle%{pybasever}.desktop +%{_datadir}/icons/hicolor/*/apps/idle%{pybasever}.* -%files tkinter +# tkinter %defattr(-,root,root,755) %{pylibdir}/tkinter %exclude %{pylibdir}/tkinter/test @@ -1390,7 +1200,7 @@ %dir %{pylibdir}/turtledemo/__pycache__/ %{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes} -%files test +# test %defattr(-, root, root) %{pylibdir}/ctypes/test %{pylibdir}/distutils/tests @@ -1412,12 +1222,10 @@ # all of the other subpackages %if %{with debug_build} -%files debug -%defattr(-,root,root,-) +# debug # Analog of the core subpackage's files: %{_bindir}/python%{LDVERSION_debug} -%{_bindir}/python3-debug # Analog of the -libs subpackage's files: # ...with debug builds of the built-in "extension" modules: @@ -1544,6 +1352,9 @@ # ====================================================== %changelog +* Wed Oct 04 2017 Aurelien Bompard - 3.6.2-1 +- Make a parallel-installable package for EPEL from Fedora package 3.6.2-19 + * Fri Sep 29 2017 Miro HronĨok - 3.6.2-19 - Move pathfix.py to bindir, https://github.com/fedora-python/python-rpm-porting/issues/24 - Make the -devel package require redhat-rpm-config