Files
MINGW-packages/mingw-w64-python3/0565-mingw-add-ModuleFileName-dir-to-PATH.patch
Алексей edc01d04d6 Update python to 3.7.0 (#4047)
* Initial python-3.7 port

* python3: Add setup.config.in to remove before patching

* python3: Implement setenv for mingw. Fix building with NT threads. Build
with unicode

* Fix typos

* Fix linking core modules

* Mingw build have exec_prefix

* Remove deprecated patch

* Fix building python and modules. Failing to build readline module and
install not working yet

* More getpath changes and more aggressive path separator conversion

* Fix readline module compilation and linking errors

* python3: By default building with posix threads, NT threads are broken.
Some patches optimization. First buildable commit

* Py_DecodeLocale handle char, not wchar

* Fix building multiprocessing module with posix threads
2018-07-06 09:57:52 +03:00

36 lines
1.5 KiB
Diff

diff -Naur Python-3.7.0-orig/Modules/getpath.c Python-3.7.0/Modules/getpath.c
--- Python-3.7.0-orig/Modules/getpath.c 2018-06-30 11:17:03.313905200 +0300
+++ Python-3.7.0/Modules/getpath.c 2018-06-30 11:17:03.547905600 +0300
@@ -1031,6 +1031,31 @@
memset(exec_prefix, 0, sizeof(exec_prefix));
calculate_exec_prefix(core_config, calculate, exec_prefix);
+#ifdef MS_WINDOWS
+ if (calculate->path_env) {
+ wchar_t *module_path, *new_path;
+ // Add path of executable/dll to system path. This
+ // is so that the correct tcl??.dll and tk??.dll get used.
+ module_path = config->dll_path[0] ? config->dll_path : config->program_full_path;
+ new_path = (wchar_t *)alloca(sizeof(wchar_t)*(wcslen(L"PATH=") + wcslen(module_path) + 1 + wcslen(calculate->path_env) + 1));
+ if (new_path) {
+ wchar_t *slashes, *end;
+ wcscpy(new_path, L"PATH=");
+ wcscat(new_path, module_path);
+ slashes = wcschr(new_path, L'/');
+ while (slashes) {
+ *slashes = L'\\';
+ slashes = wcschr(slashes+1, L'/');
+ }
+ end = wcsrchr(new_path, L'\\') ? wcsrchr(new_path, L'\\') : new_path + wcslen(new_path);
+ end[0] = L';';
+ end[1] = L'\0';
+ wcscat(new_path, calculate->path_env);
+ _wputenv(new_path);
+ }
+ }
+#endif
+
if ((!calculate->prefix_found || !calculate->exec_prefix_found) &&
!Py_FrozenFlag)
{