python27: use absolute path to dtrace(8)
[unleashed-userland.git] / components / python / python27 / patches / 04-solaris-64-bit.patch
blob663e77d451e4530b8bb3755a8eb06be48b28f6e5
1 --- Python-2.7.6/Lib/distutils/command/build_ext.py.~1~ 2013-11-09 23:36:40.000000000 -0800
2 +++ Python-2.7.6/Lib/distutils/command/build_ext.py 2014-05-14 12:47:04.342901439 -0700
3 @@ -634,6 +634,10 @@
4 filename = self.get_ext_filename(ext_name)
5 filename = os.path.split(filename)[-1]
7 + # on Solaris we put 64-bit python objects under .../64
8 + if sys.maxint != 2147483647L:
9 + filename = os.path.join("64", filename)
11 if not self.inplace:
12 # no further work needed
13 # returning :
14 @@ -674,7 +678,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)
28 def get_export_symbols (self, ext):
29 """Return the list of symbols that a shared extension has to
30 --- Python-2.7.6/Python/import.c.~1~ 2013-11-09 23:36:41.000000000 -0800
31 +++ Python-2.7.6/Python/import.c 2014-05-14 12:53:34.233016586 -0700
32 @@ -1288,6 +1288,57 @@
33 static int find_init_module(char *); /* Forward */
34 static struct filedescr importhookdescr = {"", "", IMP_HOOK};
36 +#ifdef HAVE_STAT
37 +static char *
38 +insert_64dir(char *buf, size_t buflen)
40 + char *base;
41 + char *cp;
42 + size_t blen;
44 + if ((blen = strlen(buf)) == 0)
45 + return (NULL);
47 + cp = &buf[blen - 1];
48 + while (cp != buf && *cp != SEP)
49 + cp--;
51 + if (cp != buf)
52 + cp++;
54 + if (blen + strlen("64/") + 1 >= buflen)
55 + return NULL;
57 + base = strdup(cp);
58 + sprintf(cp, "64%c%s", SEP, base);
59 + free(base);
61 + return buf;
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)
69 + struct stat statbuf;
71 + if (sizeof(void *) != 8)
72 + return 0;
74 + if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))
75 + return 0;
77 + if (fdp->type != C_EXTENSION)
78 + return 0;
80 + if (insert_64dir(buf, buflen) == NULL)
81 + return 0;
83 + return strlen("64/");
85 +#endif
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 @@ -1302,11 +1353,10 @@
91 static struct filedescr fd_builtin = {"", "", C_BUILTIN};
92 static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
93 char *name;
94 -#if defined(PYOS_OS2)
95 size_t saved_len;
96 size_t saved_namelen;
97 char *saved_buf = NULL;
98 -#endif
100 if (p_loader != NULL)
101 *p_loader = NULL;
103 @@ -1513,15 +1563,17 @@
107 -#if defined(PYOS_OS2)
108 /* take a snapshot of the module spec for restoration
109 * after the 8 character DLL hackery
111 saved_buf = strdup(buf);
112 saved_len = len;
113 saved_namelen = namelen;
114 -#endif /* PYOS_OS2 */
116 for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
117 +#ifdef HAVE_STAT
118 + len += modify_path(fdp, buf, buflen);
119 +#endif
120 #if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING)
121 /* OS/2 limits DLLs to 8 character names (w/o
122 extension)
123 @@ -1562,21 +1614,20 @@
124 fp = NULL;
127 -#if defined(PYOS_OS2)
129 /* restore the saved snapshot */
130 strcpy(buf, saved_buf);
131 len = saved_len;
132 namelen = saved_namelen;
133 -#endif
135 -#if defined(PYOS_OS2)
137 /* don't need/want the module name snapshot anymore */
138 if (saved_buf)
140 free(saved_buf);
141 saved_buf = NULL;
143 -#endif
145 Py_XDECREF(copy);
146 if (fp != NULL)
147 break;
148 --- Python-2.7.1/Python/importdl.h.orig Fri Jul 15 15:48:16 2011
149 +++ Python-2.7.1/Python/importdl.h Fri Jul 15 15:49:10 2011
150 @@ -31,8 +31,9 @@
151 extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
152 FILE *);
154 -/* Max length of module suffix searched for -- accommodates "module.slb" */
155 -#define MAXSUFFIXSIZE 12
156 +/* Max length of module suffix searched for -- accommodates "module.slb"
157 + and '64/' */
158 +#define MAXSUFFIXSIZE 15
160 #ifdef MS_WINDOWS
161 #include <windows.h>