Move /usr/bin/python into a separate package
See https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package Reverts https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build
This commit is contained in:
parent
692623a0b9
commit
002eb7557e
@ -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()
|
|
||||||
|
|
54
python2.spec
54
python2.spec
@ -108,7 +108,7 @@ Summary: An interpreted, interactive, object-oriented programming language
|
|||||||
Name: %{python}
|
Name: %{python}
|
||||||
# Remember to also rebase python2-docs when changing this:
|
# Remember to also rebase python2-docs when changing this:
|
||||||
Version: 2.7.15
|
Version: 2.7.15
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
License: Python
|
License: Python
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
|
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
|
||||||
@ -186,6 +186,15 @@ Requires: python2-pip
|
|||||||
%endif # !module_build
|
%endif # !module_build
|
||||||
%endif # rewheel
|
%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
|
||||||
|
|
||||||
|
|
||||||
# =======================
|
# =======================
|
||||||
@ -724,11 +733,6 @@ Patch193: 00193-enable-loading-sqlite-extensions.patch
|
|||||||
# 00198 #
|
# 00198 #
|
||||||
Patch198: 00198-add-rewheel-module.patch
|
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 #
|
# 00289 #
|
||||||
# Disable automatic detection for the nis module
|
# Disable automatic detection for the nis module
|
||||||
# (we handle it it in Setup.dist, see Patch0)
|
# (we handle it it in Setup.dist, see Patch0)
|
||||||
@ -756,15 +760,6 @@ Patch5000: 05000-autotool-intermediates.patch
|
|||||||
# Additional metadata, and subpackages
|
# 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/
|
URL: https://www.python.org/
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -780,6 +775,22 @@ package.
|
|||||||
This package provides the "python2" executable; most of the actual
|
This package provides the "python2" executable; most of the actual
|
||||||
implementation is within the "python2-libs" package.
|
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
|
%package libs
|
||||||
Summary: Runtime libraries for Python 2
|
Summary: Runtime libraries for Python 2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@ -1047,7 +1058,6 @@ mv Modules/cryptmodule.c Modules/_cryptmodule.c
|
|||||||
%if %{with rewheel}
|
%if %{with rewheel}
|
||||||
%patch198 -p1
|
%patch198 -p1
|
||||||
%endif
|
%endif
|
||||||
%patch288 -p1
|
|
||||||
%patch289 -p1
|
%patch289 -p1
|
||||||
|
|
||||||
|
|
||||||
@ -1574,10 +1584,13 @@ CheckPython \
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README
|
%doc README
|
||||||
%{_bindir}/pydoc*
|
%{_bindir}/pydoc*
|
||||||
%{_bindir}/python
|
|
||||||
%{_bindir}/%{python}
|
%{_bindir}/%{python}
|
||||||
%{_bindir}/python%{pybasever}
|
%{_bindir}/python%{pybasever}
|
||||||
%{_mandir}/*/*
|
%{_mandir}/*/python2*
|
||||||
|
|
||||||
|
%files -n python-unversioned-command
|
||||||
|
%{_bindir}/python
|
||||||
|
%{_mandir}/*/python.1.*
|
||||||
|
|
||||||
%files libs
|
%files libs
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
@ -1952,6 +1965,11 @@ CheckPython \
|
|||||||
# ======================================================
|
# ======================================================
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 14 2018 Miro Hrončok <mhroncok@redhat.com> - 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 <mhroncok@redhat.com> - 2.7.15-4
|
* Wed Jun 13 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-4
|
||||||
- Rebuilt for Python 3.7
|
- Rebuilt for Python 3.7
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user