Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f794ee

Browse files
committed
Issue #17095: Fix Modules/Setup *shared* support.
Original patch by Thomas Wouters.
2 parents 450ed10 + b166191 commit 8f794ee

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ Build
498498
- Issue #15968: Incorporated Tcl, Tk, and Tix builds into the Windows build
499499
solution.
500500

501+
- Issue #17095: Fix Modules/Setup *shared* support.
502+
501503
C API
502504
-----
503505
- Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ to

Modules/getpath.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,11 @@ calculate_path(void)
734734

735735
bufsz += wcslen(zip_path) + 1;
736736
bufsz += wcslen(exec_prefix) + 1;
737+
/* When running from the build directory, add room for the Modules
738+
* subdirectory too.
739+
*/
740+
if (efound == -1)
741+
bufsz += wcslen(argv0_path) + wcslen(L"Modules") + 2;
737742

738743
buf = (wchar_t *)PyMem_Malloc(bufsz * sizeof(wchar_t));
739744
if (buf == NULL) {
@@ -781,6 +786,15 @@ calculate_path(void)
781786

782787
/* Finally, on goes the directory for dynamic-load modules */
783788
wcscat(buf, exec_prefix);
789+
/* And, if we run from a build directory, the Modules directory (for
790+
* modules built with Modules/Setup.)
791+
*/
792+
if (efound == -1) {
793+
wcscat(buf, delimiter);
794+
wcscat(buf, argv0_path);
795+
wcscat(buf, separator);
796+
wcscat(buf, L"Modules");
797+
}
784798

785799
/* And publish the results */
786800
module_search_path = buf;

Modules/makesetup

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
217217
*) src='$(srcdir)/'"$srcdir/$src";;
218218
esac
219219
case $doconfig in
220-
no) cc="$cc \$(CCSHARED) \$(CFLAGS) \$(CPPFLAGS)";;
220+
no) cc="$cc \$(CCSHARED) \$(PY_CFLAGS) \$(PY_CPPFLAGS)";;
221221
*)
222222
cc="$cc \$(PY_CORE_CFLAGS)";;
223223
esac
@@ -229,11 +229,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
229229
esac
230230
for mod in $mods
231231
do
232-
case $objs in
233-
*$mod.o*) base=$mod;;
234-
*) base=${mod}module;;
235-
esac
236-
file="$srcdir/$base\$(SO)"
232+
file="$srcdir/$mod\$(EXT_SUFFIX)"
237233
case $doconfig in
238234
no) SHAREDMODS="$SHAREDMODS $file";;
239235
esac

0 commit comments

Comments
 (0)