File adapted-from-F00251-change-user-install-location.patch of Package python (Revision 7c7532457b948cc36e86ff51d95885bc)
Currently displaying revision 7c7532457b948cc36e86ff51d95885bc , Show latest
41
1
Index: Python-2.7.17/Lib/distutils/command/install.py
2
===================================================================
3
--- Python-2.7.17.orig/Lib/distutils/command/install.py
4
+++ Python-2.7.17/Lib/distutils/command/install.py
5
6
raise DistutilsOptionError, \
7
"must not supply exec-prefix without prefix"
8
9
- self.prefix = os.path.normpath(sys.prefix)
10
- self.exec_prefix = os.path.normpath(sys.exec_prefix)
11
+ # self.prefix is set to sys.prefix + /local/
12
+ # if neither RPM build nor virtual environment is
13
+ # detected to make pip and distutils install packages
14
+ # into the separate location.
15
+ if (not hasattr(sys, 'real_prefix') and
16
+ 'RPM_BUILD_ROOT' not in os.environ):
17
+ addition = "/local"
18
+ else:
19
+ addition = ""
20
+
21
+ self.prefix = os.path.normpath(sys.prefix) + addition
22
+ self.exec_prefix = os.path.normpath(sys.exec_prefix) + addition
23
24
else:
25
if self.exec_prefix is None:
26
Index: Python-2.7.17/Lib/site.py
27
===================================================================
28
--- Python-2.7.17.orig/Lib/site.py
29
+++ Python-2.7.17/Lib/site.py
30
31
sitepackages = []
32
seen = set()
33
34
+ # '/usr/local' is included in PREFIXES if RPM build is not detected
35
+ # to make packages installed into this location visible.
36
+ if ENABLE_USER_SITE and 'RPM_BUILD_ROOT' not in os.environ:
37
+ PREFIXES.insert(0, "/usr/local")
38
for prefix in PREFIXES:
39
if not prefix or prefix in seen:
40
continue
41