author | John Beck <John.Beck@Oracle.COM> |
Thu, 21 Jul 2016 12:51:35 -0700 | |
changeset 6445 | 0edecb568b2e |
parent 5183 | 3a048793fc91 |
child 7516 | 09c933391a1b |
permissions | -rw-r--r-- |
1954
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
1 |
This patch ensures that 64-bit shared objects are in a subdirectory named |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
2 |
"64". Note that changes to the Lib/distutils/tests/test_build.py and |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
3 |
Lib/distutils/tests/test_install.py avoid running tests that fail due to |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
4 |
this patch. As this is Solaris-specific, it is not suitable for upstream. |
32663e59626d
19004605 update Python 2.7 line to version 2.7.7
John Beck <John.Beck@Oracle.COM>
parents:
1914
diff
changeset
|
5 |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
6 |
--- Python-2.7.6/Lib/distutils/command/build_ext.py.~1~ 2013-11-09 23:36:40.000000000 -0800 |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
7 |
+++ Python-2.7.6/Lib/distutils/command/build_ext.py 2014-05-14 12:47:04.342901439 -0700 |
5183
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
8 |
@@ -636,6 +636,10 @@ |
458 | 9 |
filename = self.get_ext_filename(ext_name) |
10 |
filename = os.path.split(filename)[-1] |
|
11 |
||
12 |
+ # on Solaris we put 64-bit python objects under .../64 |
|
13 |
+ if sys.maxint != 2147483647L: |
|
14 |
+ filename = os.path.join("64", filename) |
|
15 |
+ |
|
16 |
if not self.inplace: |
|
17 |
# no further work needed |
|
18 |
# returning : |
|
5183
3a048793fc91
22331987 update Python 2.7 line to version 2.7.11
John Beck <John.Beck@Oracle.COM>
parents:
4698
diff
changeset
|
19 |
@@ -676,7 +680,14 @@ |
458 | 20 |
so_ext = get_config_var('SO') |
21 |
if os.name == 'nt' and self.debug: |
|
22 |
return os.path.join(*ext_path) + '_d' + so_ext |
|
23 |
- return os.path.join(*ext_path) + so_ext |
|
24 |
+ #return os.path.join(*ext_path) + so_ext |
|
25 |
+ # .so extensions are word-size specific |
|
26 |
+ path = apply(os.path.join, ext_path) |
|
27 |
+ if sys.maxint == 2147483647L: |
|
28 |
+ return path + so_ext |
|
29 |
+ dirname = os.path.dirname(path); |
|
30 |
+ basename = os.path.basename(path); |
|
31 |
+ return os.path.join(dirname, "64", basename + so_ext) |
|
32 |
||
33 |
def get_export_symbols (self, ext): |
|
34 |
"""Return the list of symbols that a shared extension has to |
|
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
35 |
--- Python-2.7.12/Python/import.c.~1~ 2016-06-25 14:49:32.000000000 -0700 |
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
36 |
+++ Python-2.7.12/Python/import.c 2016-07-07 13:43:53.807164009 -0700 |
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
37 |
@@ -1310,6 +1310,57 @@ |
458 | 38 |
static int find_init_module(char *); /* Forward */ |
39 |
static struct filedescr importhookdescr = {"", "", IMP_HOOK}; |
|
40 |
||
41 |
+#ifdef HAVE_STAT |
|
42 |
+static char * |
|
43 |
+insert_64dir(char *buf, size_t buflen) |
|
44 |
+{ |
|
45 |
+ char *base; |
|
46 |
+ char *cp; |
|
47 |
+ size_t blen; |
|
48 |
+ |
|
49 |
+ if ((blen = strlen(buf)) == 0) |
|
50 |
+ return (NULL); |
|
51 |
+ |
|
52 |
+ cp = &buf[blen - 1]; |
|
53 |
+ while (cp != buf && *cp != SEP) |
|
54 |
+ cp--; |
|
55 |
+ |
|
56 |
+ if (cp != buf) |
|
57 |
+ cp++; |
|
58 |
+ |
|
59 |
+ if (blen + strlen("64/") + 1 >= buflen) |
|
60 |
+ return NULL; |
|
61 |
+ |
|
62 |
+ base = strdup(cp); |
|
63 |
+ sprintf(cp, "64%c%s", SEP, base); |
|
64 |
+ free(base); |
|
65 |
+ |
|
66 |
+ return buf; |
|
67 |
+} |
|
68 |
+ |
|
69 |
+/* |
|
70 |
+ * If we're on a 64-bit platform, modify lookups for shared object files. |
|
71 |
+ */ |
|
72 |
+static size_t modify_path(struct filedescr *fdp, char *buf, size_t buflen) |
|
73 |
+{ |
|
74 |
+ struct stat statbuf; |
|
75 |
+ |
|
76 |
+ if (sizeof(void *) != 8) |
|
77 |
+ return 0; |
|
78 |
+ |
|
79 |
+ if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) |
|
80 |
+ return 0; |
|
81 |
+ |
|
82 |
+ if (fdp->type != C_EXTENSION) |
|
83 |
+ return 0; |
|
84 |
+ |
|
85 |
+ if (insert_64dir(buf, buflen) == NULL) |
|
86 |
+ return 0; |
|
87 |
+ |
|
88 |
+ return strlen("64/"); |
|
89 |
+} |
|
90 |
+#endif |
|
91 |
+ |
|
92 |
static struct filedescr * |
|
93 |
find_module(char *fullname, char *subname, PyObject *path, char *buf, |
|
94 |
size_t buflen, FILE **p_fp, PyObject **p_loader) |
|
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
95 |
@@ -1324,11 +1375,10 @@ |
458 | 96 |
static struct filedescr fd_builtin = {"", "", C_BUILTIN}; |
97 |
static struct filedescr fd_package = {"", "", PKG_DIRECTORY}; |
|
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
98 |
char *name; |
458 | 99 |
-#if defined(PYOS_OS2) |
100 |
size_t saved_len; |
|
101 |
size_t saved_namelen; |
|
102 |
char *saved_buf = NULL; |
|
103 |
-#endif |
|
104 |
+ |
|
105 |
if (p_loader != NULL) |
|
106 |
*p_loader = NULL; |
|
107 |
||
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
108 |
@@ -1535,15 +1585,17 @@ |
1914
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
109 |
} |
00e8dbcb9b1e
PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents:
458
diff
changeset
|
110 |
} |
458 | 111 |
} |
112 |
-#if defined(PYOS_OS2) |
|
113 |
/* take a snapshot of the module spec for restoration |
|
114 |
* after the 8 character DLL hackery |
|
115 |
*/ |
|
116 |
saved_buf = strdup(buf); |
|
117 |
saved_len = len; |
|
118 |
saved_namelen = namelen; |
|
119 |
-#endif /* PYOS_OS2 */ |
|
120 |
+ |
|
121 |
for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { |
|
122 |
+#ifdef HAVE_STAT |
|
123 |
+ len += modify_path(fdp, buf, buflen); |
|
124 |
+#endif |
|
125 |
#if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING) |
|
126 |
/* OS/2 limits DLLs to 8 character names (w/o |
|
127 |
extension) |
|
6445
0edecb568b2e
23858073 Upgrade Python 2.7 line to 2.7.12
John Beck <John.Beck@Oracle.COM>
parents:
5183
diff
changeset
|
128 |
@@ -1584,21 +1636,20 @@ |
458 | 129 |
fp = NULL; |
130 |
} |
|
131 |
} |
|
132 |
-#if defined(PYOS_OS2) |
|
133 |
+ |
|
134 |
/* restore the saved snapshot */ |
|
135 |
strcpy(buf, saved_buf); |
|
136 |
len = saved_len; |
|
137 |
namelen = saved_namelen; |
|
138 |
-#endif |
|
139 |
} |
|
140 |
-#if defined(PYOS_OS2) |
|
141 |
+ |
|
142 |
/* don't need/want the module name snapshot anymore */ |
|
143 |
if (saved_buf) |
|
144 |
{ |
|
145 |
free(saved_buf); |
|
146 |
saved_buf = NULL; |
|
147 |
} |
|
148 |
-#endif |
|
149 |
+ |
|
150 |
Py_XDECREF(copy); |
|
151 |
if (fp != NULL) |
|
152 |
break; |
|
153 |
--- Python-2.7.1/Python/importdl.h.orig Fri Jul 15 15:48:16 2011 |
|
154 |
+++ Python-2.7.1/Python/importdl.h Fri Jul 15 15:49:10 2011 |
|
155 |
@@ -31,8 +31,9 @@ |
|
156 |
extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname, |
|
157 |
FILE *); |
|
158 |
||
159 |
-/* Max length of module suffix searched for -- accommodates "module.slb" */ |
|
160 |
-#define MAXSUFFIXSIZE 12 |
|
161 |
+/* Max length of module suffix searched for -- accommodates "module.slb" |
|
162 |
+ and '64/' */ |
|
163 |
+#define MAXSUFFIXSIZE 15 |
|
164 |
||
165 |
#ifdef MS_WINDOWS |
|
166 |
#include <windows.h> |