Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extends with increments can result in missing values #176

Open
djay opened this issue Mar 17, 2014 · 3 comments · May be fixed by #644
Open

extends with increments can result in missing values #176

djay opened this issue Mar 17, 2014 · 3 comments · May be fixed by #644

Comments

@djay
Copy link

djay commented Mar 17, 2014

The following test fails

def increment_buildout_with_multiple_extended_without_base_equals():
    r"""

    >>> write('buildout.cfg', '''
    ... [buildout]
    ... extends = base1.cfg base2.cfg
    ... parts += foo
    ... [foo]
    ... recipe = zc.buildout:debug
    ... [base1]
    ... recipe = zc.buildout:debug
    ... [base2]
    ... recipe = zc.buildout:debug
    ... ''')
    >>> write('base1.cfg', '''
    ... [buildout]
    ... extends = base3.cfg
    ... parts += base1
    ... ''')
    >>> write('base2.cfg', '''
    ... [buildout]
    ... extends = base3.cfg
    ... parts += base2
    ... ''')
    >>> write('base3.cfg', '''
    ... [buildout]
    ... ''')

    >>> print_(system(buildout), end='')
    Installing base2.
      recipe='zc.buildout:debug'
    Installing foo.
      recipe='zc.buildout:debug'
    Installing base1.
      recipe='zc.buildout:debug'
    """

Currently fails as follows

Expected:
    Installing base2.
      recipe='zc.buildout:debug'
    Installing foo.
      recipe='zc.buildout:debug'
    Installing base1.
      recipe='zc.buildout:debug'
Got:
    Installing base2.
      recipe='zc.buildout:debug'
    Installing foo.
      recipe='zc.buildout:debug'

If you remove [buildout] from base3.cfg or remove the extends=base3.cfg the test will pass.

Might be related to #1060236

@djay
Copy link
Author

djay commented Mar 17, 2014

The reason this happens is that in _update_section during the first merge

_update_section("", "parts+= base1") -> "parts= base1"
_update_section("", "parts+=base2") -> "parts=base2"

Then finally

_update_section("parts=base1", "parts=base2") -> "parts=base2".

I suspect the way to fix this would be that unless you are merging += with an = then the result should still be +=. Then once everything is merged, switch any leftover += to a =.

@djay
Copy link
Author

djay commented May 13, 2014

I meant to add this is related to #22 but I think the solution is different

@distributist
Copy link

I've created a pull request that (I hope) fixes this issue: #226

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants