# DP: Do not add /usr/lib/pythonXY.zip on sys.path. Index: b/Modules/getpath.c =================================================================== --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -372,7 +372,9 @@ calculate_path(void) char *path = getenv("PATH"); char *prog = Py_GetProgramName(); char argv0_path[MAXPATHLEN+1]; +#ifdef WITH_ZIP_PATH char zip_path[MAXPATHLEN+1]; +#endif int pfound, efound; /* 1 if found; -1 if found build directory */ char *buf; size_t bufsz; @@ -512,6 +514,7 @@ calculate_path(void) else reduce(prefix); +#ifdef WITH_ZIP_PATH strncpy(zip_path, prefix, MAXPATHLEN); zip_path[MAXPATHLEN] = '\0'; if (pfound > 0) { /* Use the reduced prefix returned by Py_GetPrefix() */ @@ -524,6 +527,7 @@ calculate_path(void) bufsz = strlen(zip_path); /* Replace "00" with version */ zip_path[bufsz - 6] = VERSION[0]; zip_path[bufsz - 5] = VERSION[2]; +#endif if (!(efound = search_for_exec_prefix(argv0_path, home))) { if (!Py_FrozenFlag) @@ -563,7 +567,9 @@ calculate_path(void) defpath = delim + 1; } +#ifdef WITH_ZIP_PATH bufsz += strlen(zip_path) + 1; +#endif bufsz += strlen(exec_prefix) + 1; /* This is the only malloc call in this file */ @@ -584,9 +590,11 @@ calculate_path(void) else buf[0] = '\0'; +#ifdef WITH_ZIP_PATH /* Next is the default zip path */ strcat(buf, zip_path); strcat(buf, delimiter); +#endif /* Next goes merge of compile-time $PYTHONPATH with * dynamically located prefix.