-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-install_prefix.patch
More file actions
84 lines (77 loc) · 4.08 KB
/
Copy pathpython-install_prefix.patch
File metadata and controls
84 lines (77 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff -urNp -x '*.orig' Python-2.7.18.org/Lib/distutils/command/install.py Python-2.7.18/Lib/distutils/command/install.py
--- Python-2.7.18.org/Lib/distutils/command/install.py 2021-09-26 12:34:36.324550580 +0200
+++ Python-2.7.18/Lib/distutils/command/install.py 2021-09-26 12:34:37.124559456 +0200
@@ -13,6 +13,8 @@ from types import *
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.sysconfig import get_config_vars
+from distutils.sysconfig import PREFIX, EXEC_PREFIX
+from distutils.sysconfig import SYS_PREFIX, SYS_EXEC_PREFIX
from distutils.errors import DistutilsPlatformError
from distutils.file_util import write_file
from distutils.util import convert_path, subst_vars, change_root
@@ -306,9 +308,9 @@ class install (Command):
'py_version': py_version,
'py_version_short': py_version[0:3],
'py_version_nodot': py_version[0] + py_version[2],
- 'sys_prefix': prefix,
+ 'sys_prefix': SYS_PREFIX,
'prefix': prefix,
- 'sys_exec_prefix': exec_prefix,
+ 'sys_exec_prefix': SYS_EXEC_PREFIX,
'exec_prefix': exec_prefix,
'userbase': self.install_userbase,
'usersite': self.install_usersite,
@@ -428,8 +430,8 @@ 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 = PREFIX
+ self.exec_prefix = EXEC_PREFIX
else:
if self.exec_prefix is None:
diff -urNp -x '*.orig' Python-2.7.18.org/Lib/distutils/sysconfig.py Python-2.7.18/Lib/distutils/sysconfig.py
--- Python-2.7.18.org/Lib/distutils/sysconfig.py 2021-09-26 12:34:36.324550580 +0200
+++ Python-2.7.18/Lib/distutils/sysconfig.py 2021-09-26 12:34:37.124559456 +0200
@@ -19,8 +19,10 @@ import sys
from distutils.errors import DistutilsPlatformError
# These are needed in a couple of spots, so just compute them once.
-PREFIX = os.path.normpath(sys.prefix)
-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+SYS_PREFIX = os.path.normpath(sys.prefix)
+SYS_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+PREFIX = "/usr/local" if SYS_PREFIX == "/usr" else SYS_PREFIX
+EXEC_PREFIX = "/usr/local" if SYS_EXEC_PREFIX == "/usr" else SYS_EXEC_PREFIX
# Path to the base directory of the project. On Windows the binary may
# live in project/PCBuild9. If we're dealing with an x64 Windows build,
@@ -80,7 +82,7 @@ def get_python_inc(plat_specific=0, pref
sys.exec_prefix -- i.e., ignore 'plat_specific'.
"""
if prefix is None:
- prefix = plat_specific and EXEC_PREFIX or PREFIX
+ prefix = plat_specific and SYS_EXEC_PREFIX or SYS_PREFIX
if os.name == "posix":
if python_build:
@@ -126,7 +128,10 @@ def get_python_lib(plat_specific=0, stan
sys.exec_prefix -- i.e., ignore 'plat_specific'.
"""
if prefix is None:
- prefix = plat_specific and EXEC_PREFIX or PREFIX
+ if standard_lib:
+ prefix = plat_specific and SYS_EXEC_PREFIX or SYS_PREFIX
+ else:
+ prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
if plat_specific or standard_lib or prefix != "/usr":
diff -urNp -x '*.orig' Python-2.7.18.org/Lib/site.py Python-2.7.18/Lib/site.py
--- Python-2.7.18.org/Lib/site.py 2021-09-26 12:34:36.324550580 +0200
+++ Python-2.7.18/Lib/site.py 2021-09-26 12:34:37.124559456 +0200
@@ -64,7 +64,7 @@ import __builtin__
import traceback
# Prefixes for site-packages; add additional prefixes like /usr/local here
-PREFIXES = [sys.prefix, sys.exec_prefix]
+PREFIXES = ["/usr/local", sys.prefix, sys.exec_prefix]
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = None