diff --git a/00288-ambiguous-python-version-rpmbuild-warn.patch b/00288-ambiguous-python-version-rpmbuild-warn.patch deleted file mode 100644 index 8da5151..0000000 --- a/00288-ambiguous-python-version-rpmbuild-warn.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -U3 -r Python-2.7.14.orig/Lib/site.py Python-2.7.14/Lib/site.py ---- Python-2.7.14.orig/Lib/site.py 2018-01-29 15:05:04.517599815 +0100 -+++ Python-2.7.14/Lib/site.py 2018-01-30 09:13:17.305270500 +0100 -@@ -515,6 +515,41 @@ - "'import usercustomize' failed; use -v for traceback" - - -+def handle_ambiguous_python_version(): -+ """Warn or fail if /usr/bin/python is used -+ -+ Behavior depends on the value of PYTHON_DISALLOW_AMBIGUOUS_VERSION: -+ - "warn" - print warning to stderr -+ - "1" - print error and exit with positive exit code -+ - otherwise: do nothing -+ -+ This is a Fedora modification, see the Change page for details: -+ See https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build -+ """ -+ if sys.executable == "/usr/bin/python": -+ setting = os.environ.get("PYTHON_DISALLOW_AMBIGUOUS_VERSION") -+ if setting == 'warn': -+ print>>sys.stderr, ( -+ "DEPRECATION WARNING: python2 invoked with /usr/bin/python.\n" -+ " Use /usr/bin/python3 or /usr/bin/python2\n" -+ " /usr/bin/python will be removed or switched to Python 3" -+ " in the future.\n" -+ " If you cannot make the switch now, please follow" -+ " instructions at" -+ " https://fedoraproject.org/wiki/Changes/" -+ "Avoid_usr_bin_python_in_RPM_Build#Quick_Opt-Out") -+ elif setting == '1': -+ print>>sys.stderr, ( -+ "ERROR: python2 invoked with /usr/bin/python.\n" -+ " Use /usr/bin/python3 or /usr/bin/python2\n" -+ " /usr/bin/python will be switched to Python 3" -+ " in the future.\n" -+ " More details are at" -+ " https://fedoraproject.org/wiki/Changes/" -+ "Avoid_usr_bin_python_in_RPM_Build#Quick_Opt-Out") -+ exit(1) -+ -+ - def main(): - global ENABLE_USER_SITE - -@@ -543,6 +578,7 @@ - # this module is run as a script, because this code is executed twice. - if hasattr(sys, "setdefaultencoding"): - del sys.setdefaultencoding -+ handle_ambiguous_python_version() - - main() - diff --git a/pynche b/pynche index 368d740..4032e41 100644 --- a/pynche +++ b/pynche @@ -1,2 +1,2 @@ #!/bin/bash -exec `python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific = True))"`/pynche/pynche +exec `python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific = True))"`/pynche/pynche diff --git a/python2.spec b/python2.spec index b600d59..b02c1e5 100644 --- a/python2.spec +++ b/python2.spec @@ -12,6 +12,10 @@ # (the -debug subpackages) %bcond_without debug_build +# Only use this when bootstrapping python3 +# Needed to build setuptools for the first time +%bcond_with python3_bootstrap + %global unicode ucs4 %global python python2 @@ -68,6 +72,10 @@ # available in /usr/bin when Python is built. Also, the bytecompilation fails # on files that test invalid syntax. %undefine __brp_python_bytecompile +# The above is broken now +# https://bugzilla.redhat.com/show_bug.cgi?id=1597664 +# This is an older non-standard way to disable the brp script, as a workaround +%undefine py_auto_byte_compile # We need to get a newer configure generated out of configure.in for the following # patches: @@ -106,7 +114,7 @@ Summary: An interpreted, interactive, object-oriented programming language Name: %{python} # Remember to also rebase python2-docs when changing this: Version: 2.7.15 -Release: 1.0.riscv64%{?dist} +Release: 5.0.riscv64%{?dist} License: Python Group: Development/Languages Requires: %{python}-libs%{?_isa} = %{version}-%{release} @@ -184,6 +192,15 @@ Requires: python2-pip %endif # !module_build %endif # rewheel +# Providing python27 as now multiple interpreters exist in Fedora +# alongside the system one e.g. python26, python33 etc +Provides: python27 = %{version}-%{release} + +# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package +# We recommend /usr/bin/python so users get it by default +# Versioned recommends are problematic, and we know that the package requires +# python2 back with fixed version, so we just use the path here: +Recommends: %{_bindir}/python # ======================= @@ -722,11 +739,6 @@ Patch193: 00193-enable-loading-sqlite-extensions.patch # 00198 # Patch198: 00198-add-rewheel-module.patch -# 00288 # -# Adds a warning when /usr/bin/python is invoked during rpmbuild -# See https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build -Patch288: 00288-ambiguous-python-version-rpmbuild-warn.patch - # 00289 # # Disable automatic detection for the nis module # (we handle it it in Setup.dist, see Patch0) @@ -754,15 +766,6 @@ Patch5000: 05000-autotool-intermediates.patch # Additional metadata, and subpackages # ====================================================== -Provides: python = %{version}-%{release} -Provides: python%{?_isa} = %{version}-%{release} - - -# Providing python27 as now multiple interpreters exist in Fedora -# alongside the system one e.g. python26, python33 etc -Provides: python27 = %{version}-%{release} - - URL: https://www.python.org/ %description @@ -778,6 +781,22 @@ package. This package provides the "python2" executable; most of the actual implementation is within the "python2-libs" package. + +%package -n python-unversioned-command +Summary: The "python" command that runs Python 2 +BuildArch: noarch +# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package + +# In theory this could require any python2 version +Requires: python2 == %{version}-%{release} +# But since we want to provide versioned python, we require exact version +Provides: python = %{version}-%{release} +# This also save us an explicit conflict for older python2 builds + +%description -n python-unversioned-command +This package contains /usr/bin/python - the "python" command that runs Python 2. + + %package libs Summary: Runtime libraries for Python 2 Group: Applications/System @@ -811,9 +830,15 @@ Group: Development/Libraries Requires: %{python}%{?_isa} = %{version}-%{release} Requires: python-rpm-macros Requires: python2-rpm-macros -Requires: python3-rpm-generators Requires: pkgconfig +%if %{without python3_bootstrap} +# When bootstrapping python3, we need to build setuptools +# But setuptools BR python2-devel and that brings in python3-rpm-generators +# python3-rpm-generators needs python3-setuptools, so we cannot have it yet +Requires: python3-rpm-generators +%endif + # 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 @@ -1039,7 +1064,6 @@ mv Modules/cryptmodule.c Modules/_cryptmodule.c %if %{with rewheel} %patch198 -p1 %endif -%patch288 -p1 %patch289 -p1 @@ -1241,7 +1265,7 @@ make install DESTDIR=%{buildroot} # %if 0%{?with_gdb_hooks} DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir} -PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName.debug-gdb.py +PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_arch}.debug-gdb.py mkdir -p %{buildroot}$DirHoldingGdbPy cp $topdir/Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy @@ -1484,7 +1508,9 @@ find %{buildroot} -type f -a -name "*.py" -print0 | \ # Make library-files user writable /usr/bin/chmod 755 %{buildroot}%{dynload_dir}/*.so /usr/bin/chmod 755 %{buildroot}%{_libdir}/libpython%{pybasever}.so.1.0 +%if %{with debug_build} /usr/bin/chmod 755 %{buildroot}%{_libdir}/libpython%{pybasever}_d.so.1.0 +%endif # ====================================================== @@ -1564,10 +1590,13 @@ CheckPython \ %license LICENSE %doc README %{_bindir}/pydoc* -%{_bindir}/python %{_bindir}/%{python} %{_bindir}/python%{pybasever} -%{_mandir}/*/* +%{_mandir}/*/python2* + +%files -n python-unversioned-command +%{_bindir}/python +%{_mandir}/*/python.1.* %files libs %defattr(-,root,root,-) @@ -1942,9 +1971,23 @@ CheckPython \ # ====================================================== %changelog -* Mon May 07 2018 David Abdurachmanov - 2.7.15-1.0.riscv64 +* Mon Jul 16 2018 David Abdurachmanov - 2.7.15-5.0.riscv64 - Disable gdb_hooks as we do not build debug* packages at this point (no GDB available) +* Thu Jun 14 2018 Miro Hrončok - 2.7.15-5 +- Move /usr/bin/python into a separate package + https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package +- Revert https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build + +* Wed Jun 13 2018 Miro Hrončok - 2.7.15-4 +- Rebuilt for Python 3.7 + +* Wed Jun 13 2018 Miro Hrončok - 2.7.15-3 +- Bootstrap for Python 3.7 + +* Tue May 15 2018 Charalampos Stratakis - 2.7.15-2 +- Fix loading of the gdb python plugin (rhbz#1578001) + * Tue May 01 2018 Miro Hrončok - 2.7.15-1 - Update to version 2.7.15