multilib.patch 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. commit 248279e54467a8cd5cde98fc124d1d1384703513
  2. Author: Yu Ke <ke.yu@intel.com>
  3. Date: Tue Jun 28 21:21:29 2011 +0800
  4. SUSE patch for the lib64 issue
  5. see detail in http://bugs.python.org/issue1294959
  6. also rebased a bit for Yocto python 2.6.6
  7. Picked-by: Yu Ke <ke.yu@intel.com>
  8. 2011/09/29
  9. The python recipe building was failing because python-native
  10. could not handle sys.lib var. sys.lib var is defined in the
  11. multilib patch hence added this multilib.patch for python-native
  12. recipe.
  13. Upstream-Status: Inappropriate [oe-specific]
  14. Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
  15. Index: Python-2.7.2/Include/pythonrun.h
  16. ===================================================================
  17. --- Python-2.7.2.orig/Include/pythonrun.h
  18. +++ Python-2.7.2/Include/pythonrun.h
  19. @@ -108,6 +108,7 @@ PyAPI_FUNC(char *) Py_GetPath(void);
  20. /* In their own files */
  21. PyAPI_FUNC(const char *) Py_GetVersion(void);
  22. PyAPI_FUNC(const char *) Py_GetPlatform(void);
  23. +PyAPI_FUNC(const char *) Py_GetLib(void);
  24. PyAPI_FUNC(const char *) Py_GetCopyright(void);
  25. PyAPI_FUNC(const char *) Py_GetCompiler(void);
  26. PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
  27. Index: Python-2.7.2/Lib/distutils/command/install.py
  28. ===================================================================
  29. --- Python-2.7.2.orig/Lib/distutils/command/install.py
  30. +++ Python-2.7.2/Lib/distutils/command/install.py
  31. @@ -22,6 +22,8 @@ from site import USER_BASE
  32. from site import USER_SITE
  33. +libname = sys.lib
  34. +
  35. if sys.version < "2.2":
  36. WINDOWS_SCHEME = {
  37. 'purelib': '$base',
  38. @@ -42,7 +44,7 @@ else:
  39. INSTALL_SCHEMES = {
  40. 'unix_prefix': {
  41. 'purelib': '$base/lib/python$py_version_short/site-packages',
  42. - 'platlib': '$platbase/lib/python$py_version_short/site-packages',
  43. + 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
  44. 'headers': '$base/include/python$py_version_short/$dist_name',
  45. 'scripts': '$base/bin',
  46. 'data' : '$base',
  47. Index: Python-2.7.2/Lib/pydoc.py
  48. ===================================================================
  49. --- Python-2.7.2.orig/Lib/pydoc.py
  50. +++ Python-2.7.2/Lib/pydoc.py
  51. @@ -352,7 +352,7 @@ class Doc:
  52. docloc = os.environ.get("PYTHONDOCS",
  53. "http://docs.python.org/library")
  54. - basedir = os.path.join(sys.exec_prefix, "lib",
  55. + basedir = os.path.join(sys.exec_prefix, sys.lib,
  56. "python"+sys.version[0:3])
  57. if (isinstance(object, type(os)) and
  58. (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
  59. Index: Python-2.7.2/Lib/site.py
  60. ===================================================================
  61. --- Python-2.7.2.orig/Lib/site.py
  62. +++ Python-2.7.2/Lib/site.py
  63. @@ -300,13 +300,19 @@ def getsitepackages():
  64. if sys.platform in ('os2emx', 'riscos'):
  65. sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
  66. elif os.sep == '/':
  67. - sitepackages.append(os.path.join(prefix, "lib",
  68. + sitepackages.append(os.path.join(prefix, sys.lib,
  69. "python" + sys.version[:3],
  70. "site-packages"))
  71. - sitepackages.append(os.path.join(prefix, "lib", "site-python"))
  72. + if sys.lib != "lib":
  73. + sitepackages.append(os.path.join(prefix, "lib",
  74. + "python" + sys.version[:3],
  75. + "site-packages"))
  76. + sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
  77. + if sys.lib != "lib":
  78. + sitepackages.append(os.path.join(prefix, "lib", "site-python"))
  79. else:
  80. sitepackages.append(prefix)
  81. - sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
  82. + sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
  83. if sys.platform == "darwin":
  84. # for framework builds *only* we add the standard Apple
  85. # locations.
  86. Index: Python-2.7.2/Lib/test/test_dl.py
  87. ===================================================================
  88. --- Python-2.7.2.orig/Lib/test/test_dl.py
  89. +++ Python-2.7.2/Lib/test/test_dl.py
  90. @@ -5,10 +5,11 @@
  91. import unittest
  92. from test.test_support import verbose, import_module
  93. dl = import_module('dl', deprecated=True)
  94. +import sys
  95. sharedlibs = [
  96. - ('/usr/lib/libc.so', 'getpid'),
  97. - ('/lib/libc.so.6', 'getpid'),
  98. + ('/usr/'+sys.lib+'/libc.so', 'getpid'),
  99. + ('/'+sys.lib+'/libc.so.6', 'getpid'),
  100. ('/usr/bin/cygwin1.dll', 'getpid'),
  101. ('/usr/lib/libc.dylib', 'getpid'),
  102. ]
  103. Index: Python-2.7.2/Lib/trace.py
  104. ===================================================================
  105. --- Python-2.7.2.orig/Lib/trace.py
  106. +++ Python-2.7.2/Lib/trace.py
  107. @@ -762,10 +762,10 @@ def main(argv=None):
  108. # should I also call expanduser? (after all, could use $HOME)
  109. s = s.replace("$prefix",
  110. - os.path.join(sys.prefix, "lib",
  111. + os.path.join(sys.prefix, sys.lib,
  112. "python" + sys.version[:3]))
  113. s = s.replace("$exec_prefix",
  114. - os.path.join(sys.exec_prefix, "lib",
  115. + os.path.join(sys.exec_prefix, sys.lib,
  116. "python" + sys.version[:3]))
  117. s = os.path.normpath(s)
  118. ignore_dirs.append(s)
  119. Index: Python-2.7.2/Makefile.pre.in
  120. ===================================================================
  121. --- Python-2.7.2.orig/Makefile.pre.in
  122. +++ Python-2.7.2/Makefile.pre.in
  123. @@ -81,6 +81,7 @@ PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAG
  124. # Machine-dependent subdirectories
  125. MACHDEP= @MACHDEP@
  126. +LIB= @LIB@
  127. # Install prefix for architecture-independent files
  128. prefix= @prefix@
  129. @@ -97,7 +98,7 @@ LIBDIR= @libdir@
  130. MANDIR= @mandir@
  131. INCLUDEDIR= @includedir@
  132. CONFINCLUDEDIR= $(exec_prefix)/include
  133. -SCRIPTDIR= $(prefix)/lib
  134. +SCRIPTDIR= $(prefix)/@LIB@
  135. # Detailed destination directories
  136. BINLIBDEST= $(LIBDIR)/python$(VERSION)
  137. @@ -532,6 +533,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
  138. -DEXEC_PREFIX='"$(exec_prefix)"' \
  139. -DVERSION='"$(VERSION)"' \
  140. -DVPATH='"$(VPATH)"' \
  141. + -DLIB='"$(LIB)"' \
  142. -o $@ $(srcdir)/Modules/getpath.c
  143. Modules/python.o: $(srcdir)/Modules/python.c
  144. @@ -566,7 +568,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
  145. Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
  146. Python/getplatform.o: $(srcdir)/Python/getplatform.c
  147. - $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
  148. + $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
  149. Python/importdl.o: $(srcdir)/Python/importdl.c
  150. $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
  151. Index: Python-2.7.2/Modules/getpath.c
  152. ===================================================================
  153. --- Python-2.7.2.orig/Modules/getpath.c
  154. +++ Python-2.7.2/Modules/getpath.c
  155. @@ -116,9 +116,11 @@
  156. #define EXEC_PREFIX PREFIX
  157. #endif
  158. +#define LIB_PYTHON LIB "/python" VERSION
  159. +
  160. #ifndef PYTHONPATH
  161. -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
  162. - EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
  163. +#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
  164. + EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
  165. #endif
  166. #ifndef LANDMARK
  167. @@ -129,7 +131,7 @@ static char prefix[MAXPATHLEN+1];
  168. static char exec_prefix[MAXPATHLEN+1];
  169. static char progpath[MAXPATHLEN+1];
  170. static char *module_search_path = NULL;
  171. -static char lib_python[] = "lib/python" VERSION;
  172. +static char lib_python[] = LIB_PYTHON;
  173. static void
  174. reduce(char *dir)
  175. Index: Python-2.7.2/Python/getplatform.c
  176. ===================================================================
  177. --- Python-2.7.2.orig/Python/getplatform.c
  178. +++ Python-2.7.2/Python/getplatform.c
  179. @@ -10,3 +10,13 @@ Py_GetPlatform(void)
  180. {
  181. return PLATFORM;
  182. }
  183. +
  184. +#ifndef LIB
  185. +#define LIB "lib"
  186. +#endif
  187. +
  188. +const char *
  189. +Py_GetLib(void)
  190. +{
  191. + return LIB;
  192. +}
  193. Index: Python-2.7.2/Python/sysmodule.c
  194. ===================================================================
  195. --- Python-2.7.2.orig/Python/sysmodule.c
  196. +++ Python-2.7.2/Python/sysmodule.c
  197. @@ -1416,6 +1416,8 @@ _PySys_Init(void)
  198. PyString_FromString(Py_GetCopyright()));
  199. SET_SYS_FROM_STRING("platform",
  200. PyString_FromString(Py_GetPlatform()));
  201. + SET_SYS_FROM_STRING("lib",
  202. + PyString_FromString(Py_GetLib()));
  203. SET_SYS_FROM_STRING("executable",
  204. PyString_FromString(Py_GetProgramFullPath()));
  205. SET_SYS_FROM_STRING("prefix",
  206. Index: Python-2.7.2/configure.in
  207. ===================================================================
  208. --- Python-2.7.2.orig/configure.in
  209. +++ Python-2.7.2/configure.in
  210. @@ -629,6 +629,10 @@ SunOS*)
  211. ;;
  212. esac
  213. +AC_SUBST(LIB)
  214. +AC_MSG_CHECKING(LIB)
  215. +LIB=`basename ${libdir}`
  216. +AC_MSG_RESULT($LIB)
  217. AC_SUBST(LIBRARY)
  218. AC_MSG_CHECKING(LIBRARY)