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

Skip to content

Commit b166191

Browse files
committed
Issue #17095: Fix Modules/Setup *shared* support.
Original patch by Thomas Wouters.
1 parent e81c637 commit b166191

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ Library
5858
- Issue #21538: The plistlib module now supports loading of binary plist files
5959
when reference or offset size is not a power of two.
6060

61+
Build
62+
-----
63+
64+
- Issue #17095: Fix Modules/Setup *shared* support.
65+
6166
Tests
6267
-----
6368

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)