File: no-zip-on-sys.path.diff

package info (click to toggle)
python2.7 2.7.16-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,524 kB
  • sloc: python: 469,695; ansic: 444,315; sh: 17,604; asm: 14,304; makefile: 4,899; objc: 761; exp: 499; cpp: 128; xml: 76
file content (54 lines) | stat: -rw-r--r-- 1,629 bytes parent folder | download | duplicates (3)
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
53
54
# 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.