Accepting request 745290 from home:StevenK:branches:devel:languages:python:Factory

- Add adapted-from-F00251-change-user-install-location.patch fixing
  pip/distutils to install into /usr/local.

OBS-URL: https://build.opensuse.org/request/show/745290
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=257
This commit is contained in:
Tomáš Chvátal 2019-11-05 07:55:07 +00:00 committed by Git OBS Bridge
parent 5167eaaa6a
commit 00800c2a14
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,40 @@
Index: Python-2.7.17/Lib/distutils/command/install.py
===================================================================
--- Python-2.7.17.orig/Lib/distutils/command/install.py
+++ Python-2.7.17/Lib/distutils/command/install.py
@@ -431,8 +431,18 @@ class install (Command):
raise DistutilsOptionError, \
"must not supply exec-prefix without prefix"
- self.prefix = os.path.normpath(sys.prefix)
- self.exec_prefix = os.path.normpath(sys.exec_prefix)
+ # self.prefix is set to sys.prefix + /local/
+ # if neither RPM build nor virtual environment is
+ # detected to make pip and distutils install packages
+ # into the separate location.
+ if (not hasattr(sys, 'real_prefix') and
+ 'RPM_BUILD_ROOT' not in os.environ):
+ addition = "/local"
+ else:
+ addition = ""
+
+ self.prefix = os.path.normpath(sys.prefix) + addition
+ self.exec_prefix = os.path.normpath(sys.exec_prefix) + addition
else:
if self.exec_prefix is None:
Index: Python-2.7.17/Lib/site.py
===================================================================
--- Python-2.7.17.orig/Lib/site.py
+++ Python-2.7.17/Lib/site.py
@@ -291,6 +291,10 @@ def getsitepackages():
sitepackages = []
seen = set()
+ # '/usr/local' is included in PREFIXES if RPM build is not detected
+ # to make packages installed into this location visible.
+ if ENABLE_USER_SITE and 'RPM_BUILD_ROOT' not in os.environ:
+ PREFIXES.insert(0, "/usr/local")
for prefix in PREFIXES:
if not prefix or prefix in seen:
continue

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Nov 5 04:24:05 UTC 2019 - Steve Kowalik <steven.kowalik@suse.com>
- Add adapted-from-F00251-change-user-install-location.patch fixing
pip/distutils to install into /usr/local.
-------------------------------------------------------------------
Thu Oct 24 14:40:39 CEST 2019 - Matej Cepl <mcepl@suse.com>

View File

@ -74,6 +74,12 @@ Patch49: CVE-2019-5010-null-defer-x509-cert-DOS.patch
Patch50: bpo36160-init-sysconfig_vars.patch
# PATCH-FIX-UPSTREAM https://github.com/python/cpython/pull/12341
Patch55: bpo36302-sort-module-sources.patch
# Fix installation in /usr/local (boo#1071941), adapted from Fedora
# https://src.fedoraproject.org/rpms/python3/blob/master/f/00251-change-user-install-location.patch
# Set values of prefix and exec_prefix in distutils install command
# to /usr/local if executable is /usr/bin/python* and RPM build
# is not detected to make pip and distutils install into separate location
Patch56: adapted-from-F00251-change-user-install-location.patch
# COMMON-PATCH-END
%define python_version %(echo %{tarversion} | head -c 3)
BuildRequires: automake
@ -186,6 +192,7 @@ other applications.
%patch49 -p1
%patch50 -p1
%patch55 -p1
%patch56 -p1
# drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac