[Python-checkins] bpo-46023: makesetup: skip all duplicate modules (GH-32234)

tiran webhook-mailer at python.org
Fri Apr 1 11:23:21 EDT 2022


https://github.com/python/cpython/commit/abdd69c95c1711c2dc75be4e784c6d6c80a409b9
commit: abdd69c95c1711c2dc75be4e784c6d6c80a409b9
branch: main
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2022-04-01T17:23:12+02:00
summary:

bpo-46023: makesetup: skip all duplicate modules (GH-32234)

files:
A Misc/NEWS.d/next/Build/2022-04-01-16-12-53.bpo-46023.1Z1OcC.rst
M Modules/makesetup

diff --git a/Misc/NEWS.d/next/Build/2022-04-01-16-12-53.bpo-46023.1Z1OcC.rst b/Misc/NEWS.d/next/Build/2022-04-01-16-12-53.bpo-46023.1Z1OcC.rst
new file mode 100644
index 0000000000000..cb2f7b760e1ec
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2022-04-01-16-12-53.bpo-46023.1Z1OcC.rst
@@ -0,0 +1,2 @@
+``makesetup`` now detects and skips all duplicated module definitions. The
+first entry wins.
diff --git a/Modules/makesetup b/Modules/makesetup
index 3909650ed7c41..9b20e3c9f6344 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -117,6 +117,7 @@ sed -e 's/[ 	]*#.*//' -e '/^[ 	]*$/d' |
 	BUILT=
 	BUILT_SHARED=
 	DISABLED=
+	CONFIGURED=
 	MODS=
 	SHAREDMODS=
 	OBJS=
@@ -206,12 +207,17 @@ sed -e 's/[ 	]*#.*//' -e '/^[ 	]*$/d' |
 			cpps="\$(MODULE_${mods_upper}_CFLAGS)"
 			libs="\$(MODULE_${mods_upper}_LDFLAGS)"
 		fi
-		case $DISABLED in
-		*$mods*)
-			# disabled by previous rule / Setup file
-			continue
-			;;
-		esac
+		for mod in $mods
+		do
+			case $CONFIGURED in
+			*,${mod},*)
+				# Detected multiple rules for a module, first rule wins. This
+				# allows users to disable modules in Setup.local.
+				echo 1>&2 "maksetup: '$mod' was handled by previous rule."
+				continue 2;;
+			esac
+			CONFIGURED="$CONFIGURED,${mod},"
+		done
 		case $doconfig in
 		yes)
 			LIBS="$LIBS $libs"



More information about the Python-checkins mailing list