-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path00251-change-user-install-location.patch
More file actions
70 lines (65 loc) · 3.24 KB
/
00251-change-user-install-location.patch
File metadata and controls
70 lines (65 loc) · 3.24 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
diff -Nura Python-3.10.0-orig/Lib/site.py Python-3.10.0/Lib/site.py
--- Python-3.10.0-orig/Lib/site.py 2021-10-04 17:40:46.000000000 +0000
+++ Python-3.10.0/Lib/site.py 2021-10-20 12:56:50.986449337 +0000
@@ -380,8 +380,15 @@
return sitepackages
def addsitepackages(known_paths, prefixes=None):
- """Add site-packages to sys.path"""
+ """Add site-packages to sys.path
+
+ '/usr/local' is included in PREFIXES if RPM build is not detected
+ to make packages installed into this location visible.
+
+ """
_trace("Processing global site-packages")
+ if ENABLE_USER_SITE and 'RPM_BUILD_ROOT' not in os.environ:
+ PREFIXES.insert(0, "/opt/rh/rh-python310/root/usr/local")
for sitedir in getsitepackages(prefixes):
if os.path.isdir(sitedir):
addsitedir(sitedir, known_paths)
diff -Nura Python-3.10.0-orig/Lib/sysconfig.py Python-3.10.0/Lib/sysconfig.py
--- Python-3.10.0-orig/Lib/sysconfig.py 2021-10-04 17:40:46.000000000 +0000
+++ Python-3.10.0/Lib/sysconfig.py 2021-10-20 12:58:09.037274987 +0000
@@ -58,6 +58,25 @@
},
}
+# backup the original posix_prefix as rpm_prefix
+# RPM packages use it and we need to be able to read it even when changed
+_INSTALL_SCHEMES['rpm_prefix'] = _INSTALL_SCHEMES['posix_prefix']
+
+if (not (hasattr(sys, 'real_prefix') or
+ sys.prefix != sys.base_prefix) and
+ 'RPM_BUILD_ROOT' not in os.environ):
+ _INSTALL_SCHEMES['posix_prefix'] = {
+ 'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
+ 'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
+ 'purelib': '{base}/local/lib/python{py_version_short}/site-packages',
+ 'platlib': '{platbase}/local/{platlibdir}/python{py_version_short}/site-packages',
+ 'include':
+ '{installed_base}/include/python{py_version_short}{abiflags}',
+ 'platinclude':
+ '{installed_platbase}/include/python{py_version_short}{abiflags}',
+ 'scripts': '{base}/local/bin',
+ 'data': '{base}/local',
+ }
# NOTE: site.py has copy of this function.
# Sync it when modify this function.
diff -Nura Python-3.10.0-orig/Lib/test/test_sysconfig.py Python-3.10.0/Lib/test/test_sysconfig.py
--- Python-3.10.0-orig/Lib/test/test_sysconfig.py 2021-10-04 17:40:46.000000000 +0000
+++ Python-3.10.0/Lib/test/test_sysconfig.py 2021-10-20 12:59:33.345327310 +0000
@@ -263,7 +263,7 @@
self.assertTrue(os.path.isfile(config_h), config_h)
def test_get_scheme_names(self):
- wanted = ['nt', 'posix_home', 'posix_prefix']
+ wanted = ['nt', 'posix_home', 'posix_prefix', 'rpm_prefix']
if HAS_USER_BASE:
wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
@@ -274,6 +274,8 @@
cmd = "-c", "import sysconfig; print(sysconfig.get_platform())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))
+ @unittest.skipIf('RPM_BUILD_ROOT' not in os.environ,
+ "Test doesn't expect Fedora's paths")
def test_user_similar(self):
# Issue #8759: make sure the posix scheme for the users
# is similar to the global posix_prefix one