From a53abd219d887969e8158aa531111327f8cc0a36 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Mon, 18 Dec 2023 18:09:59 +0100 Subject: [PATCH] [fix] Fix +=/-= support for keys in the same file Before this, += and -= worked correctly when applied to a key defined in a file extended by the current file, but not when the key was in the same file. e.g.: ``` [part] a = this case is ``` ``` [buildout] extends = a.cfg [part] a += ok b = this case is b += not-ok ``` Co-authored-by: Xavier Thompson <xavier.thompson@nexedi.com> --- src/zc/buildout/buildout.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zc/buildout/buildout.py b/src/zc/buildout/buildout.py index b66763b..8ab1dd3 100644 --- a/src/zc/buildout/buildout.py +++ b/src/zc/buildout/buildout.py @@ -2041,7 +2041,10 @@ def _update(d1, d2): if section in d1: _update_section(d1[section], d2[section]) else: - d1[section] = d2[section] + # In order to process += (and -=) correctly when + # <key> = <value> and <key> += <value> are in the same section + # _update_section must be called even when section is not in d1 + d1[section] = _update_section({}, d2[section]) return d1 def _recipe(options): -- 2.30.9