• Julien Muchembled's avatar
    [feat] Enable partial support for += / -= with <= · 13a17b06
    Julien Muchembled authored
    Before this, += and -= worked well when applied to keys defined in the
    current section or in a section of the same name inherited from a file
    extended by the current file, but not to keys inherited from another
    section using macro extension <=, because <= substitution happens later
    and all the += and -= are already resolved.
    
    e.g.:
    
    ```
    [macro]
    a = 1
    
    [part]
    <= macro
    a += 2
    ```
    
    was equivalent to
    
    ```
    [part]
    a = 1
    a = 2
    ```
    
    instead of
    
    ```
    [part]
    a = 1
    a += 2
    ```
    
    Now a partial and brittle support for this is enabled by postponing
    += and -= resolution until <= substitution happens when the current
    section contains a <= extension. But this is not guaranteed: if the
    current section is overloaded in another file extending the current
    one, then += and -= resolution will happend then, before <=.
    
    A consistent solution would be to unify the implementation of
    extends= and <= and update sections by taking both into account,
    instead of updating based only on extends and computing <= later,
    leading to inconsistencies. This could be achieved e.g. by computing
    section updates on demand during substitution.
    Co-authored-by: Xavier Thompson's avatarXavier Thompson <xavier.thompson@nexedi.com>
    13a17b06
buildout.py 84.3 KB