|
1 --- Python-2.7.1/Lib/distutils/command/build_ext.py.orig Fri Jul 15 15:32:28 2011 |
|
2 +++ Python-2.7.1/Lib/distutils/command/build_ext.py Fri Jul 15 15:37:00 2011 |
|
3 @@ -637,6 +637,10 @@ |
|
4 filename = self.get_ext_filename(ext_name) |
|
5 filename = os.path.split(filename)[-1] |
|
6 |
|
7 + # on Solaris we put 64-bit python objects under .../64 |
|
8 + if sys.maxint != 2147483647L: |
|
9 + filename = os.path.join("64", filename) |
|
10 + |
|
11 if not self.inplace: |
|
12 # no further work needed |
|
13 # returning : |
|
14 @@ -677,7 +681,14 @@ |
|
15 so_ext = get_config_var('SO') |
|
16 if os.name == 'nt' and self.debug: |
|
17 return os.path.join(*ext_path) + '_d' + so_ext |
|
18 - return os.path.join(*ext_path) + so_ext |
|
19 + #return os.path.join(*ext_path) + so_ext |
|
20 + # .so extensions are word-size specific |
|
21 + path = apply(os.path.join, ext_path) |
|
22 + if sys.maxint == 2147483647L: |
|
23 + return path + so_ext |
|
24 + dirname = os.path.dirname(path); |
|
25 + basename = os.path.basename(path); |
|
26 + return os.path.join(dirname, "64", basename + so_ext) |
|
27 |
|
28 def get_export_symbols (self, ext): |
|
29 """Return the list of symbols that a shared extension has to |
|
30 --- Python-2.7.1/Python/import.c.orig Fri Jul 15 15:41:33 2011 |
|
31 +++ Python-2.7.1/Python/import.c Fri Jul 15 15:46:55 2011 |
|
32 @@ -1197,6 +1197,57 @@ |
|
33 static int find_init_module(char *); /* Forward */ |
|
34 static struct filedescr importhookdescr = {"", "", IMP_HOOK}; |
|
35 |
|
36 +#ifdef HAVE_STAT |
|
37 +static char * |
|
38 +insert_64dir(char *buf, size_t buflen) |
|
39 +{ |
|
40 + char *base; |
|
41 + char *cp; |
|
42 + size_t blen; |
|
43 + |
|
44 + if ((blen = strlen(buf)) == 0) |
|
45 + return (NULL); |
|
46 + |
|
47 + cp = &buf[blen - 1]; |
|
48 + while (cp != buf && *cp != SEP) |
|
49 + cp--; |
|
50 + |
|
51 + if (cp != buf) |
|
52 + cp++; |
|
53 + |
|
54 + if (blen + strlen("64/") + 1 >= buflen) |
|
55 + return NULL; |
|
56 + |
|
57 + base = strdup(cp); |
|
58 + sprintf(cp, "64%c%s", SEP, base); |
|
59 + free(base); |
|
60 + |
|
61 + return buf; |
|
62 +} |
|
63 + |
|
64 +/* |
|
65 + * If we're on a 64-bit platform, modify lookups for shared object files. |
|
66 + */ |
|
67 +static size_t modify_path(struct filedescr *fdp, char *buf, size_t buflen) |
|
68 +{ |
|
69 + struct stat statbuf; |
|
70 + |
|
71 + if (sizeof(void *) != 8) |
|
72 + return 0; |
|
73 + |
|
74 + if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) |
|
75 + return 0; |
|
76 + |
|
77 + if (fdp->type != C_EXTENSION) |
|
78 + return 0; |
|
79 + |
|
80 + if (insert_64dir(buf, buflen) == NULL) |
|
81 + return 0; |
|
82 + |
|
83 + return strlen("64/"); |
|
84 +} |
|
85 +#endif |
|
86 + |
|
87 static struct filedescr * |
|
88 find_module(char *fullname, char *subname, PyObject *path, char *buf, |
|
89 size_t buflen, FILE **p_fp, PyObject **p_loader) |
|
90 @@ -1214,11 +1265,10 @@ |
|
91 static struct filedescr fd_builtin = {"", "", C_BUILTIN}; |
|
92 static struct filedescr fd_package = {"", "", PKG_DIRECTORY}; |
|
93 char name[MAXPATHLEN+1]; |
|
94 -#if defined(PYOS_OS2) |
|
95 size_t saved_len; |
|
96 size_t saved_namelen; |
|
97 char *saved_buf = NULL; |
|
98 -#endif |
|
99 + |
|
100 if (p_loader != NULL) |
|
101 *p_loader = NULL; |
|
102 |
|
103 @@ -1437,7 +1487,6 @@ |
|
104 } |
|
105 #endif |
|
106 #endif |
|
107 -#if defined(PYOS_OS2) |
|
108 /* take a snapshot of the module spec for restoration |
|
109 * after the 8 character DLL hackery |
|
110 */ |
|
111 @@ -1444,8 +1493,11 @@ |
|
112 saved_buf = strdup(buf); |
|
113 saved_len = len; |
|
114 saved_namelen = namelen; |
|
115 -#endif /* PYOS_OS2 */ |
|
116 + |
|
117 for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { |
|
118 +#ifdef HAVE_STAT |
|
119 + len += modify_path(fdp, buf, buflen); |
|
120 +#endif |
|
121 #if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING) |
|
122 /* OS/2 limits DLLs to 8 character names (w/o |
|
123 extension) |
|
124 @@ -1486,14 +1538,13 @@ |
|
125 fp = NULL; |
|
126 } |
|
127 } |
|
128 -#if defined(PYOS_OS2) |
|
129 + |
|
130 /* restore the saved snapshot */ |
|
131 strcpy(buf, saved_buf); |
|
132 len = saved_len; |
|
133 namelen = saved_namelen; |
|
134 -#endif |
|
135 } |
|
136 -#if defined(PYOS_OS2) |
|
137 + |
|
138 /* don't need/want the module name snapshot anymore */ |
|
139 if (saved_buf) |
|
140 { |
|
141 @@ -1500,7 +1551,7 @@ |
|
142 free(saved_buf); |
|
143 saved_buf = NULL; |
|
144 } |
|
145 -#endif |
|
146 + |
|
147 Py_XDECREF(copy); |
|
148 if (fp != NULL) |
|
149 break; |
|
150 --- Python-2.7.1/Python/importdl.h.orig Fri Jul 15 15:48:16 2011 |
|
151 +++ Python-2.7.1/Python/importdl.h Fri Jul 15 15:49:10 2011 |
|
152 @@ -31,8 +31,9 @@ |
|
153 extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname, |
|
154 FILE *); |
|
155 |
|
156 -/* Max length of module suffix searched for -- accommodates "module.slb" */ |
|
157 -#define MAXSUFFIXSIZE 12 |
|
158 +/* Max length of module suffix searched for -- accommodates "module.slb" |
|
159 + and '64/' */ |
|
160 +#define MAXSUFFIXSIZE 15 |
|
161 |
|
162 #ifdef MS_WINDOWS |
|
163 #include <windows.h> |