jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / python / python37 / patches / 30-no-zip-in-sys-path.patch
blob6f629a40f3f68406b78c16b4793e551768263ede
1 From OmniOSCE
3 By default, python places a zip file at the start of the module path
5 >>> import sys; sys.path
6 ['', '/usr/lib/python35.zip', '/usr/lib/python3.5', ...
8 We don't ship this or have any need to provide modules there, so remove it
9 from the path. This also cleans up package dependency resolution output
10 which frequently refers to this non-existent file.
12 diff -wpruN '--exclude=*.orig' a~/Modules/getpath.c a/Modules/getpath.c
13 --- a~/Modules/getpath.c 1970-01-01 00:00:00
14 +++ a/Modules/getpath.c 1970-01-01 00:00:00
15 @@ -124,7 +124,9 @@ typedef struct {
17 wchar_t *lib_python; /* "lib/pythonX.Y" */
18 wchar_t argv0_path[MAXPATHLEN+1];
19 +#ifndef SKIP_ZIP_PATH
20 wchar_t zip_path[MAXPATHLEN+1]; /* ".../lib/pythonXY.zip" */
21 +#endif
23 int prefix_found; /* found platform independent libraries? */
24 int exec_prefix_found; /* found the platform dependent libraries? */
25 @@ -772,7 +774,7 @@ calculate_read_pyenv(PyCalculatePath *ca
26 fclose(env_file);
30 +#ifndef SKIP_ZIP_PATH
31 static void
32 calculate_zip_path(PyCalculatePath *calculate, const wchar_t *prefix)
34 @@ -794,6 +796,7 @@ calculate_zip_path(PyCalculatePath *calc
35 calculate->zip_path[bufsz - 6] = VERSION[0];
36 calculate->zip_path[bufsz - 5] = VERSION[2];
38 +#endif
41 static _PyInitError
42 @@ -828,7 +831,9 @@ calculate_module_search_path(const _PyCo
43 defpath = delim + 1;
46 +#ifndef SKIP_ZIP_PATH
47 bufsz += wcslen(calculate->zip_path) + 1;
48 +#endif
49 bufsz += wcslen(exec_prefix) + 1;
51 /* Allocate the buffer */
52 @@ -845,8 +850,10 @@ calculate_module_search_path(const _PyCo
55 /* Next is the default zip path */
56 +#ifndef SKIP_ZIP_PATH
57 wcscat(buf, calculate->zip_path);
58 wcscat(buf, delimiter);
59 +#endif
61 /* Next goes merge of compile-time $PYTHONPATH with
62 * dynamically located prefix.
63 @@ -953,7 +960,9 @@ calculate_path_impl(const _PyCoreConfig
64 memset(prefix, 0, sizeof(prefix));
65 calculate_prefix(core_config, calculate, prefix);
67 +#ifndef SKIP_ZIP_PATH
68 calculate_zip_path(calculate, prefix);
69 +#endif
71 wchar_t exec_prefix[MAXPATHLEN+1];
72 memset(exec_prefix, 0, sizeof(exec_prefix));