blob: 0bfa0d2cf432ed15f08e74bb64beb7ff5e48a064 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Rebased for python-2.7.9
2Signed-Off-By: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
3
4Index: Python-2.7.9/configure.ac
5===================================================================
6--- Python-2.7.9.orig/configure.ac
7+++ Python-2.7.9/configure.ac
8@@ -736,6 +736,10 @@ SunOS*)
9 ;;
10 esac
11
12+AC_SUBST(LIB)
13+AC_MSG_CHECKING(LIB)
14+LIB=`basename ${libdir}`
15+AC_MSG_RESULT($LIB)
16
17 AC_SUBST(LIBRARY)
18 AC_MSG_CHECKING(LIBRARY)
19Index: Python-2.7.9/Include/pythonrun.h
20===================================================================
21--- Python-2.7.9.orig/Include/pythonrun.h
22+++ Python-2.7.9/Include/pythonrun.h
23@@ -108,6 +108,7 @@ PyAPI_FUNC(char *) Py_GetPath(void);
24 /* In their own files */
25 PyAPI_FUNC(const char *) Py_GetVersion(void);
26 PyAPI_FUNC(const char *) Py_GetPlatform(void);
27+PyAPI_FUNC(const char *) Py_GetLib(void);
28 PyAPI_FUNC(const char *) Py_GetCopyright(void);
29 PyAPI_FUNC(const char *) Py_GetCompiler(void);
30 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
31Index: Python-2.7.9/Lib/distutils/command/install.py
32===================================================================
33--- Python-2.7.9.orig/Lib/distutils/command/install.py
34+++ Python-2.7.9/Lib/distutils/command/install.py
35@@ -22,6 +22,8 @@ from site import USER_BASE
36 from site import USER_SITE
37
38
39+libname = sys.lib
40+
41 if sys.version < "2.2":
42 WINDOWS_SCHEME = {
43 'purelib': '$base',
44@@ -42,7 +44,7 @@ else:
45 INSTALL_SCHEMES = {
46 'unix_prefix': {
47 'purelib': '$base/lib/python$py_version_short/site-packages',
48- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
49+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
50 'headers': '$base/include/python$py_version_short/$dist_name',
51 'scripts': '$base/bin',
52 'data' : '$base',
53Index: Python-2.7.9/Lib/distutils/sysconfig.py
54===================================================================
55--- Python-2.7.9.orig/Lib/distutils/sysconfig.py
56+++ Python-2.7.9/Lib/distutils/sysconfig.py
57@@ -119,8 +119,11 @@ def get_python_lib(plat_specific=0, stan
58 prefix = plat_specific and EXEC_PREFIX or PREFIX
59
60 if os.name == "posix":
61- libpython = os.path.join(prefix,
62- "lib", "python" + get_python_version())
63+ if plat_specific or standard_lib:
64+ lib = sys.lib
65+ else:
66+ lib = "lib"
67+ libpython = os.path.join(prefix, lib, "python" + get_python_version())
68 if standard_lib:
69 return libpython
70 else:
71Index: Python-2.7.9/Lib/pydoc.py
72===================================================================
73--- Python-2.7.9.orig/Lib/pydoc.py
74+++ Python-2.7.9/Lib/pydoc.py
75@@ -383,7 +383,7 @@ class Doc:
76
77 docloc = os.environ.get("PYTHONDOCS",
78 "http://docs.python.org/library")
79- basedir = os.path.join(sys.exec_prefix, "lib",
80+ basedir = os.path.join(sys.exec_prefix, sys.lib,
81 "python"+sys.version[0:3])
82 if (isinstance(object, type(os)) and
83 (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
84Index: Python-2.7.9/Lib/site.py
85===================================================================
86--- Python-2.7.9.orig/Lib/site.py
87+++ Python-2.7.9/Lib/site.py
88@@ -288,13 +288,18 @@ def getsitepackages():
89 if sys.platform in ('os2emx', 'riscos'):
90 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
91 elif os.sep == '/':
92- sitepackages.append(os.path.join(prefix, "lib",
93+ sitepackages.append(os.path.join(prefix, sys.lib,
94 "python" + sys.version[:3],
95 "site-packages"))
96- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
97+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
98+ if sys.lib != "lib":
99+ sitepackages.append(os.path.join(prefix, "lib",
100+ "python" + sys.version[:3],
101+ "site-packages"))
102+ sitepackages.append(os.path.join(prefix, "lib", "site-python"))
103 else:
104 sitepackages.append(prefix)
105- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
106+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
107 if sys.platform == "darwin":
108 # for framework builds *only* we add the standard Apple
109 # locations.
110Index: Python-2.7.9/Lib/sysconfig.py
111===================================================================
112--- Python-2.7.9.orig/Lib/sysconfig.py
113+++ Python-2.7.9/Lib/sysconfig.py
114@@ -7,10 +7,10 @@ from os.path import pardir, realpath
115
116 _INSTALL_SCHEMES = {
117 'posix_prefix': {
118- 'stdlib': '{base}/lib/python{py_version_short}',
119- 'platstdlib': '{platbase}/lib/python{py_version_short}',
120+ 'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
121+ 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
122 'purelib': '{base}/lib/python{py_version_short}/site-packages',
123- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
124+ 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
125 'include': '{base}/include/python{py_version_short}',
126 'platinclude': '{platbase}/include/python{py_version_short}',
127 'scripts': '{base}/bin',
128@@ -65,10 +65,10 @@ _INSTALL_SCHEMES = {
129 'data' : '{userbase}',
130 },
131 'posix_user': {
132- 'stdlib': '{userbase}/lib/python{py_version_short}',
133- 'platstdlib': '{userbase}/lib/python{py_version_short}',
134+ 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
135+ 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
136 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
137- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
138+ 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
139 'include': '{userbase}/include/python{py_version_short}',
140 'scripts': '{userbase}/bin',
141 'data' : '{userbase}',
142Index: Python-2.7.9/Lib/test/test_dl.py
143===================================================================
144--- Python-2.7.9.orig/Lib/test/test_dl.py
145+++ Python-2.7.9/Lib/test/test_dl.py
146@@ -4,10 +4,11 @@
147 import unittest
148 from test.test_support import verbose, import_module
149 dl = import_module('dl', deprecated=True)
150+import sys
151
152 sharedlibs = [
153- ('/usr/lib/libc.so', 'getpid'),
154- ('/lib/libc.so.6', 'getpid'),
155+ ('/usr/'+sys.lib+'/libc.so', 'getpid'),
156+ ('/'+sys.lib+'/libc.so.6', 'getpid'),
157 ('/usr/bin/cygwin1.dll', 'getpid'),
158 ('/usr/lib/libc.dylib', 'getpid'),
159 ]
160Index: Python-2.7.9/Lib/test/test_site.py
161===================================================================
162--- Python-2.7.9.orig/Lib/test/test_site.py
163+++ Python-2.7.9/Lib/test/test_site.py
164@@ -241,12 +241,16 @@ class HelperFunctionsTests(unittest.Test
165 self.assertEqual(dirs[2], wanted)
166 elif os.sep == '/':
167 # OS X non-framwework builds, Linux, FreeBSD, etc
168- self.assertEqual(len(dirs), 2)
169 wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
170 'site-packages')
171- self.assertEqual(dirs[0], wanted)
172+ self.assertTrue(wanted in dirs)
173 wanted = os.path.join('xoxo', 'lib', 'site-python')
174- self.assertEqual(dirs[1], wanted)
175+ self.assertTrue(wanted in dirs)
176+ wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
177+ 'site-packages')
178+ self.assertTrue(wanted in dirs)
179+ wanted = os.path.join('xoxo', sys.lib, 'site-python')
180+ self.assertTrue(wanted in dirs)
181 else:
182 # other platforms
183 self.assertEqual(len(dirs), 2)
184Index: Python-2.7.9/Lib/trace.py
185===================================================================
186--- Python-2.7.9.orig/Lib/trace.py
187+++ Python-2.7.9/Lib/trace.py
188@@ -754,10 +754,10 @@ def main(argv=None):
189 # should I also call expanduser? (after all, could use $HOME)
190
191 s = s.replace("$prefix",
192- os.path.join(sys.prefix, "lib",
193+ os.path.join(sys.prefix, sys.lib,
194 "python" + sys.version[:3]))
195 s = s.replace("$exec_prefix",
196- os.path.join(sys.exec_prefix, "lib",
197+ os.path.join(sys.exec_prefix, sys.lib,
198 "python" + sys.version[:3]))
199 s = os.path.normpath(s)
200 ignore_dirs.append(s)
201Index: Python-2.7.9/Makefile.pre.in
202===================================================================
203--- Python-2.7.9.orig/Makefile.pre.in
204+++ Python-2.7.9/Makefile.pre.in
205@@ -87,6 +87,7 @@ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAG
206
207 # Machine-dependent subdirectories
208 MACHDEP= @MACHDEP@
209+LIB= @LIB@
210
211 # Multiarch directory (may be empty)
212 MULTIARCH= @MULTIARCH@
213@@ -106,7 +107,7 @@ LIBDIR= @libdir@
214 MANDIR= @mandir@
215 INCLUDEDIR= @includedir@
216 CONFINCLUDEDIR= $(exec_prefix)/include
217-SCRIPTDIR= $(prefix)/lib
218+SCRIPTDIR= $(prefix)/@LIB@
219
220 # Detailed destination directories
221 BINLIBDEST= $(LIBDIR)/python$(VERSION)
222@@ -598,6 +599,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
223 -DEXEC_PREFIX='"$(exec_prefix)"' \
224 -DVERSION='"$(VERSION)"' \
225 -DVPATH='"$(VPATH)"' \
226+ -DLIB='"$(LIB)"' \
227 -o $@ $(srcdir)/Modules/getpath.c
228
229 Modules/python.o: $(srcdir)/Modules/python.c
230@@ -640,7 +642,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
231 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
232
233 Python/getplatform.o: $(srcdir)/Python/getplatform.c
234- $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
235+ $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
236
237 Python/importdl.o: $(srcdir)/Python/importdl.c
238 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
239Index: Python-2.7.9/Modules/getpath.c
240===================================================================
241--- Python-2.7.9.orig/Modules/getpath.c
242+++ Python-2.7.9/Modules/getpath.c
243@@ -116,9 +116,11 @@
244 #define EXEC_PREFIX PREFIX
245 #endif
246
247+#define LIB_PYTHON LIB "/python" VERSION
248+
249 #ifndef PYTHONPATH
250-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
251- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
252+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
253+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
254 #endif
255
256 #ifndef LANDMARK
257@@ -129,7 +131,7 @@ static char prefix[MAXPATHLEN+1];
258 static char exec_prefix[MAXPATHLEN+1];
259 static char progpath[MAXPATHLEN+1];
260 static char *module_search_path = NULL;
261-static char lib_python[] = "lib/python" VERSION;
262+static char lib_python[] = LIB_PYTHON;
263
264 static void
265 reduce(char *dir)
266Index: Python-2.7.9/Python/getplatform.c
267===================================================================
268--- Python-2.7.9.orig/Python/getplatform.c
269+++ Python-2.7.9/Python/getplatform.c
270@@ -10,3 +10,13 @@ Py_GetPlatform(void)
271 {
272 return PLATFORM;
273 }
274+
275+#ifndef LIB
276+#define LIB "lib"
277+#endif
278+
279+const char *
280+Py_GetLib(void)
281+{
282+ return LIB;
283+}
284Index: Python-2.7.9/Python/sysmodule.c
285===================================================================
286--- Python-2.7.9.orig/Python/sysmodule.c
287+++ Python-2.7.9/Python/sysmodule.c
288@@ -1437,6 +1437,8 @@ _PySys_Init(void)
289 PyString_FromString(Py_GetCopyright()));
290 SET_SYS_FROM_STRING("platform",
291 PyString_FromString(Py_GetPlatform()));
292+ SET_SYS_FROM_STRING("lib",
293+ PyString_FromString(Py_GetLib()));
294 SET_SYS_FROM_STRING("executable",
295 PyString_FromString(Py_GetProgramFullPath()));
296 SET_SYS_FROM_STRING("prefix",