]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46023: makesetup: skip all duplicate modules (GH-32234)
authorChristian Heimes <christian@python.org>
Fri, 1 Apr 2022 15:23:12 +0000 (18:23 +0300)
committerGitHub <noreply@github.com>
Fri, 1 Apr 2022 15:23:12 +0000 (17:23 +0200)
Misc/NEWS.d/next/Build/2022-04-01-16-12-53.bpo-46023.1Z1OcC.rst [new file with mode: 0644]
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 (file)
index 0000000..cb2f7b7
--- /dev/null
@@ -0,0 +1,2 @@
+``makesetup`` now detects and skips all duplicated module definitions. The
+first entry wins.
index 3909650ed7c417c6c1567000a603586e769fe9a3..9b20e3c9f634424cbaae8cf6602ea7929faf7de8 100755 (executable)
@@ -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"