aboutsummaryrefslogtreecommitdiff
path: root/examples/python2.7/patches/no-zip-on-sys.path.diff
blob: 74ce88f3e925409ab380a12a81f00a0c2f41901a (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# DP: Do not add /usr/lib/pythonXY.zip on sys.path.

--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -380,7 +380,9 @@
     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;
@@ -520,6 +522,7 @@
     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() */
@@ -532,6 +535,7 @@
     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)
@@ -571,7 +575,9 @@
         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 */
@@ -592,9 +598,11 @@
         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.