From 9b45e76f346612898d8619db09e895617e275df2 Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Oct 05 2017 13:01:16 +0000 Subject: Platform-Python: modify and add subpackages --- diff --git a/python3.spec b/python3.spec index 4c19b74..296f562 100644 --- a/python3.spec +++ b/python3.spec @@ -14,7 +14,7 @@ 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: 20%{?dist} License: Python @@ -25,6 +25,9 @@ License: Python # Note that the bcond macros are named for the CLI option they create. # "%%bcond_without" means "ENABLE by default and create a --without option" +# Platform-Python build +%bcond_with platform_python + # Expensive optimizations (mainly, profile-guided optimizations) %ifarch %{ix86} x86_64 %bcond_without optimizations @@ -215,6 +218,7 @@ BuildRequires: /usr/bin/dtrace BuildRequires: /usr/sbin/ifconfig %if %{with rewheel} +# For Platform-Python: We build require the python3- instead of the python36- versions so we don't have to bootstrap Platform-Python. The python3- versions are available in the module called `bootstrap`. BuildRequires: python3-setuptools BuildRequires: python3-pip %endif @@ -409,6 +413,47 @@ Patch274: 00274-fix-arch-names.patch # Descriptions, and metadata for subpackages # ========================================== +# The description used both for the SRPM and the main `python3` +# (and also `python36` in case of platform-python) subpackage(s): +%global _description_main \ +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. + + +%if %{with platform_python} +# Main shim package: python3 requiring python36 +Requires: python%{python3_pkgversion} == %{version} + +%if %{with rewheel} +Requires: python3-setuptools +Requires: python3-pip +%endif +%endif # with platform_python + +%description %{_description_main} + + +# Main package, named python3, or python36 for platform-python +%if %{with platform_python} +%package -n python%{python3_pkgversion} +Summary: %{summary} +%endif + # Packages with Python modules in standard locations automatically # depend on python(abi). Provide that here. Provides: python(abi) = %{pybasever} @@ -433,33 +478,12 @@ Provides: python%{pyshortver} = %{version}-%{release} # replace python36-3.6.2. Obsoletes: python%{pyshortver} -%if %{with rewheel} -Requires: python3-setuptools -Requires: python3-pip +%if %{with platform_python} +%description -n python%{python3_pkgversion} %{_description_main} %endif -# 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 +%package -n python%{python3_pkgversion}-libs Summary: Python runtime libraries # The "enum" module is included in the standard library. @@ -476,14 +500,25 @@ 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 +%global _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 +%description -n python%{python3_pkgversion}-libs %{_description_libs} + -%package devel +%if %{with platform_python} +%package -n python3-libs +Summary: Python runtime libraries +Requires: python%{python3_pkgversion}-libs == %{version} + +%description -n python3-libs %{_description_libs} +%endif + + +%package -n python%{python3_pkgversion}-devel Summary: Libraries and header files needed for Python development Requires: %{name} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -500,15 +535,26 @@ 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. - +%global _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. +%description -n python%{python3_pkgversion}-devel %{_description_devel} + + +%if %{with platform_python} +%package -n python3-devel +Summary: Libraries and header files needed for Python development +Requires: python%{python3_pkgversion}-devel == %{version} + +%description -n python3-devel %{_description_devel} +%endif + -%package tools +%package -n python%{python3_pkgversion}-tools Summary: A collection of tools included with Python including 2to3 and idle Requires: %{name} = %{version}-%{release} Requires: %{name}-tkinter = %{version}-%{release} @@ -524,37 +570,69 @@ Provides: idle3 = %{version}-%{release} 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 +%global _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 +%description -n python%{python3_pkgversion}-tools %{_description_tools} + + +%if %{with platform_python} +%package -n python3-tools +Summary: A collection of tools included with Python including 2to3 and idle +Requires: python%{python3_pkgversion}-tools == %{version} + +%description -n python3-tools %{_description_tools} +%endif -%package tkinter + +%package -n python%{python3_pkgversion}-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 +%global _description_tkinter \ +The Tkinter (Tk interface) library is a graphical user interface toolkit for\ the Python programming language. +%description -n python%{python3_pkgversion}-tkinter %{_description_tkinter} + -%package test +%if %{with platform_python} +%package -n python3-tkinter +Summary: A GUI toolkit for Python +Requires: python%{python3_pkgversion}-tkinter == %{version} + +%description -n python3-tkinter %{_description_tkinter} +%endif + + +%package -n python%{python3_pkgversion}-test Summary: The self-test suite for the main python3 package Requires: %{name} = %{version}-%{release} Requires: %{name}-tools = %{version}-%{release} +%global _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. -%description test -The self-test suite for the Python interpreter. +%description -n python%{python3_pkgversion}-test %{_description_test} -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 platform_python} +%package -n python3-test +Summary: The self-test suite for the main python3 package +Requires: python%{python3_pkgversion}-test == %{version} + +%description -n python3-test %{_description_test} +%endif %if %{with debug_build} -%package debug +%package -n python%{python3_pkgversion}-debug Summary: Debug version of the Python runtime # The debug build is an all-in-one package version of the regular build, and @@ -567,23 +645,34 @@ 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. +%global _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. -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. +%description -n python%{python3_pkgversion}-debug %{_description_debug} -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. +%if %{with platform_python} +%package -n python3-debug +Summary: Debug version of the Python runtime +Requires: python%{python3_pkgversion}-debug == %{version} + +%description -n python3-debug %{_description_debug} +%endif # with platform_python %endif # with debug_build @@ -992,6 +1081,21 @@ ln -s \ mkdir -p %{buildroot}%{_libexecdir} ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/system-python +%if %{with platform_python} +# Platform Python: Copy the executable to libexec +mkdir -p %{buildroot}%{_libexecdir} +cp %{buildroot}%{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/platform-python + +# Remove the python3 and python3.X executables in bindir so they can be +# replaced with symlinks +rm %{buildroot}%{_bindir}/python3 +rm %{buildroot}%{_bindir}/python%{pybasever} + +# Create a symlink to platform-python from bindir +ln -s %{_libexecdir}/platform-python %{buildroot}%{_bindir}/python%{pybasever} +ln -s python%{pybasever} %{buildroot}%{_bindir}/python3 +%endif + # ====================================================== # Checks for packaging issues @@ -1003,7 +1107,11 @@ ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/system-python find %{buildroot} -type f -a -name "*.py" -print0 | \ LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \ PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \ +%if %{with platform_python} + xargs -0 %{buildroot}%{_libexecdir}/platform-python %{SOURCE8} +%else xargs -0 %{buildroot}%{_bindir}/python%{pybasever} %{SOURCE8} +%endif # Ensure that the curses module was linked against libncursesw.so, rather than # libncurses.so @@ -1106,10 +1214,24 @@ fi %posttrans /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : -%files +%if %{with platform_python} +%files -n python3 +%license LICENSE +%doc README.rst +%{_bindir}/python3 +%{_bindir}/python%{pybasever} +%{_mandir}/*/* +%endif + +%files -n python%{python3_pkgversion} %defattr(-, root, root) %license LICENSE %doc README.rst +%if %{with platform_python} +%{_libexecdir}/platform-python +%exclude %{_libexecdir}/system-python +%exclude %{_bindir}/* +%else %{_bindir}/pydoc* %{_bindir}/python3 %{_bindir}/python%{pybasever} @@ -1119,8 +1241,15 @@ fi %{_mandir}/*/* # Remove in Fedora 29: %{_libexecdir}/system-python +%endif -%files libs +%if %{with platform_python} +%files -n python3-libs +%license LICENSE +%doc README.rst +%endif + +%files -n python%{python3_pkgversion}-libs %defattr(-,root,root,-) %license LICENSE %doc README.rst @@ -1345,7 +1474,12 @@ fi %doc systemtap-example.stp pyfuntop.stp %endif -%files devel +%if %{with platform_python} +%files -n python3-devel +%doc Misc/README.valgrind Misc/valgrind-python.supp Misc/gdbinit +%endif + +%files -n python%{python3_pkgversion}-devel %defattr(-,root,root) %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/* %exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile @@ -1365,7 +1499,11 @@ fi %{_rpmconfigdir}/macros.d/macros.pybytecompile%{pybasever} %{_rpmconfigdir}/macros.d/macros.systempython -%files tools +%if %{with platform_python} +%files -n python3-tools +%endif + +%files -n python%{python3_pkgversion}-tools %defattr(-,root,root,755) %{_bindir}/2to3 # TODO: Remove 2to3-3.7 once rebased to 3.7 @@ -1377,7 +1515,11 @@ fi %{_datadir}/applications/idle3.desktop %{_datadir}/icons/hicolor/*/apps/idle3.* -%files tkinter +%if %{with platform_python} +%files -n python3-tkinter +%endif + +%files -n python%{python3_pkgversion}-tkinter %defattr(-,root,root,755) %{pylibdir}/tkinter %exclude %{pylibdir}/tkinter/test @@ -1390,7 +1532,11 @@ fi %dir %{pylibdir}/turtledemo/__pycache__/ %{pylibdir}/turtledemo/__pycache__/*%{bytecode_suffixes} -%files test +%if %{with platform_python} +%files -n python3-test +%endif + +%files -n python%{python3_pkgversion}-test %defattr(-, root, root) %{pylibdir}/ctypes/test %{pylibdir}/distutils/tests @@ -1412,7 +1558,11 @@ fi # all of the other subpackages %if %{with debug_build} -%files debug +%if %{with platform_python} +%files -n python3-debug +%endif + +%files -n python%{python3_pkgversion}-debug %defattr(-,root,root,-) # Analog of the core subpackage's files: @@ -1544,6 +1694,9 @@ fi # ====================================================== %changelog +* Thu Oct 05 2017 Tomas Orsava - 3.6.2-20 +- Modified the spec file to build Platform-Python + * 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