• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:directory +full:- +full:prefix

11 #include <mach-o/dyld.h>
16 * Two directories must be found, the platform independent directory
17 * (prefix), containing the common .py and .pyc files, and the platform
18 * dependent directory (exec_prefix), containing the shared library
19 * modules. Note that prefix and exec_prefix can be the same directory,
22 * Py_GetPath() carries out separate searches for prefix and exec_prefix.
24 * file or directory is found. If no prefix or exec_prefix is found, a
25 * warning message is issued and the preprocessor defined PREFIX and
38 * pathname if one is found) and the directory of the link target is used.
40 * Finally, argv0_path is set to the directory containing the executable
44 * are performed for prefix and for exec_prefix, but with a different
47 * Step 1. Are we running python out of the build directory? This is
49 * argv0_path. For prefix, the landmark's path is derived from the VPATH
54 * For the remaining steps, the prefix landmark will always be
56 * lib/python$VERSION/lib-dynload, where $VERSION is Python's version
58 * build directory checking is performed; if the first step did not find
64 * it points to prefix and exec_prefix. $PYTHONHOME can be a single
65 * directory, which is used for both, or the prefix and exec_prefix
68 * Step 3. Try to find prefix and exec_prefix relative to argv0_path,
70 * step to succeed. Note that if prefix and exec_prefix are different,
72 * subdirectory of prefix, both will be found.
75 * PREFIX and EXEC_PREFIX. These are supplied by the Makefile but can be
80 * Well, almost. Once we have determined prefix and exec_prefix, the
82 * relative path on PYTHONPATH is prefixed with prefix. Then the directory
85 * prefix and exec_prefix globals are tweaked so they reflect the values
87 * off. If either points to the build directory, the globals are reset to
88 * the corresponding preprocessor variables (so sys.prefix will reflect the
90 * directory). This seems to make more sense given that currently the only
91 * known use of sys.prefix and sys.exec_prefix is for the ILU installation
100 #if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH)
101 #error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined"
108 static char prefix[MAXPATHLEN+1]; variable
123 --i; in reduce()
129 isfile(char *filename) /* Is file, not directory */ in isfile()
141 ismodule(char *filename) /* Is module -- check for .pyc/.pyo too */ in ismodule()
146 /* Check for the compiled version of prefix. */ in ismodule()
171 isdir(char *filename) /* Is directory */ in isdir()
184 NUL-terminated string with no more than MAXPATHLEN characters (not counting
187 guaranteed that buffer will still be a NUL-terminated string with no more
199 if (n > 0 && buffer[n-1] != SEP && n < MAXPATHLEN) in joinpath()
206 k = MAXPATHLEN - n; in joinpath()
220 /* unable to get the current directory */ in copy_absolute()
254 strncpy(prefix, home, MAXPATHLEN); in search_for_prefix()
255 delim = strchr(prefix, DELIM); in search_for_prefix()
258 joinpath(prefix, lib_python); in search_for_prefix()
259 joinpath(prefix, LANDMARK); in search_for_prefix()
263 /* Check to see if argv[0] is in the build directory */ in search_for_prefix()
264 strcpy(prefix, argv0_path); in search_for_prefix()
265 joinpath(prefix, "Modules/Setup"); in search_for_prefix()
266 if (isfile(prefix)) { in search_for_prefix()
267 /* Check VPATH to see if argv0_path is in the build directory. */ in search_for_prefix()
269 strcpy(prefix, argv0_path); in search_for_prefix()
270 joinpath(prefix, vpath); in search_for_prefix()
271 joinpath(prefix, "Lib"); in search_for_prefix()
272 joinpath(prefix, LANDMARK); in search_for_prefix()
273 if (ismodule(prefix)) in search_for_prefix()
274 return -1; in search_for_prefix()
278 copy_absolute(prefix, argv0_path); in search_for_prefix()
280 n = strlen(prefix); in search_for_prefix()
281 joinpath(prefix, lib_python); in search_for_prefix()
282 joinpath(prefix, LANDMARK); in search_for_prefix()
283 if (ismodule(prefix)) in search_for_prefix()
285 prefix[n] = '\0'; in search_for_prefix()
286 reduce(prefix); in search_for_prefix()
287 } while (prefix[0]); in search_for_prefix()
289 /* Look at configure's PREFIX */ in search_for_prefix()
290 strncpy(prefix, PREFIX, MAXPATHLEN); in search_for_prefix()
291 joinpath(prefix, lib_python); in search_for_prefix()
292 joinpath(prefix, LANDMARK); in search_for_prefix()
293 if (ismodule(prefix)) in search_for_prefix()
318 joinpath(exec_prefix, "lib-dynload"); in search_for_exec_prefix()
322 /* Check to see if argv[0] is in the build directory. "pybuilddir.txt" in search_for_exec_prefix()
339 return -1; in search_for_exec_prefix()
348 joinpath(exec_prefix, "lib-dynload"); in search_for_exec_prefix()
358 joinpath(exec_prefix, "lib-dynload"); in search_for_exec_prefix()
381 int pfound, efound; /* 1 if found; -1 if found build directory */ in calculate_path()
399 * other way to find a directory to start the search from. If in calculate_path()
423 size_t len = delim - path; in calculate_path()
454 ** be outside of the framework. Except when we're in the build directory... in calculate_path()
461 /* See if we might be in the build directory. The framework in the in calculate_path()
462 ** build directory is incomplete, it only has the .dylib and a few in calculate_path()
464 ** If we're running with the framework from the build directory we must in calculate_path()
465 ** be running the interpreter in the build directory, so we use the in calculate_path()
466 ** build-directory-specific logic to find Lib and such. in calculate_path()
473 /* We are in the build directory so use the name of the in calculate_path()
474 executable - we know that the absolute path is passed */ in calculate_path()
488 while (linklen != -1) { in calculate_path()
513 "Could not find platform independent libraries <prefix>\n"); in calculate_path()
514 strncpy(prefix, PREFIX, MAXPATHLEN); in calculate_path()
515 joinpath(prefix, lib_python); in calculate_path()
518 reduce(prefix); in calculate_path()
520 strncpy(zip_path, prefix, MAXPATHLEN); in calculate_path()
522 if (pfound > 0) { /* Use the reduced prefix returned by Py_GetPrefix() */ in calculate_path()
527 strncpy(zip_path, PREFIX, MAXPATHLEN); in calculate_path()
530 zip_path[bufsz - 6] = VERSION[0]; in calculate_path()
531 zip_path[bufsz - 5] = VERSION[2]; in calculate_path()
538 joinpath(exec_prefix, "lib/lib-dynload"); in calculate_path()
544 "Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]\n"); in calculate_path()
553 prefixsz = strlen(prefix) + 1; in calculate_path()
559 /* Paths are relative to prefix */ in calculate_path()
563 bufsz += delim - defpath + 1; in calculate_path()
588 /* Run-time value of $PYTHONPATH goes first */ in calculate_path()
602 /* Next goes merge of compile-time $PYTHONPATH with in calculate_path()
603 * dynamically located prefix. in calculate_path()
610 strcat(buf, prefix); in calculate_path()
611 if (prefixsz >= 2 && prefix[prefixsz - 2] != SEP && in calculate_path()
618 size_t len = delim - defpath + 1; in calculate_path()
632 /* Finally, on goes the directory for dynamic-load modules */ in calculate_path()
640 /* Reduce prefix and exec_prefix to their essence, in calculate_path()
642 * If we're loading relative to the build directory, in calculate_path()
643 * return the compiled-in defaults instead. in calculate_path()
646 reduce(prefix); in calculate_path()
647 reduce(prefix); in calculate_path()
648 /* The prefix is the root directory, but reduce() chopped in calculate_path()
650 if (!prefix[0]) in calculate_path()
651 strcpy(prefix, separator); in calculate_path()
654 strncpy(prefix, PREFIX, MAXPATHLEN); in calculate_path()
683 return prefix; in Py_GetPrefix()