-
Notifications
You must be signed in to change notification settings - Fork 5
/
getpath.c.ed
33 lines (33 loc) · 1.06 KB
/
getpath.c.ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/mach-o\/dyld\.h/c
#include <dlfcn.h>
.
/NSModule pythonModule/c
Dl_info addrinfo;
int first_pass = 1;
.
.,$g/__APPLE__/s//notdef/
/NSModuleForSymbol/a
.
.,/NSLibraryNameForModule/c
/* dladdr() now returns the real path of the dylib, instead of the
** path of the symlink. This breaks virtualenv. To fix this, we
** skip using dladdr() during a first pass, and if that fails, then
** we go back and do the dladdr(). It turns out that since we moved
** Python.app to inside the Python.framework bundle, the call to
** search_for_prefix() will now succeed without needing dladdr().
** However, virtualenv copies the wrong binary when the prefix is
** /usr, so if progpath begins with /usr/bin/, we skip the first pass.
*/
if (strncmp(progpath, "/usr/bin/", 9) == 0) first_pass = 0;
return_here_for_second_pass:
buf = first_pass ? NULL : (dladdr("_Py_Initialize", &addrinfo) ? (char *)addrinfo.dli_fname : NULL);
.
/search_for_prefix(/a
#ifdef WITH_NEXT_FRAMEWORK
if (first_pass) {
first_pass = 0;
goto return_here_for_second_pass;
}
#endif
.
w