Commit 818082c4 authored by Łukasz Nowak's avatar Łukasz Nowak

Merge branch 'bug_717802'

parents e52a53c4 39442e5d
...@@ -1385,6 +1385,11 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1385,6 +1385,11 @@ def _open(base, filename, seen, dl_options, override, downloaded):
Recursively open other files based on buildout options found. Recursively open other files based on buildout options found.
""" """
counter = 0
while filename.startswith('../'):
filename = filename.replace('../', '', 1)
counter += 1
base = base.rsplit('/', counter)[0]
_update_section(dl_options, override) _update_section(dl_options, override)
_dl_options = _unannotate_section(dl_options.copy()) _dl_options = _unannotate_section(dl_options.copy())
newest = _convert_bool('newest', _dl_options.get('newest', 'false')) newest = _convert_bool('newest', _dl_options.get('newest', 'false'))
......
...@@ -463,18 +463,35 @@ used: ...@@ -463,18 +463,35 @@ used:
... extends = baseB.cfg ... extends = baseB.cfg
... bar = foo ... bar = foo
... """) ... """)
>>> write(server_data, 'baseD.cfg', """\
... [buildout]
... extends-cache = cache
... extends = baseC.cfg
... bar = foo
... """)
>>> mkdir(server_data, 'deeper')
>>> write(server_data, 'deeper', 'base.cfg', """\
... [buildout]
... extends-cache = cache
... extends = ../baseD.cfg
... bar = foo
... """)
>>> write('buildout.cfg', """\ >>> write('buildout.cfg', """\
... [buildout] ... [buildout]
... extends-cache = cache ... extends-cache = cache
... newest = true ... newest = true
... extends = %sbaseA.cfg %sbaseB.cfg %sbaseC.cfg ... extends = %sbaseA.cfg %sbaseB.cfg %sbaseC.cfg %sdeeper/base.cfg
... """ % (server_url, server_url, server_url)) ... """ % (server_url, server_url, server_url, server_url))
>>> print system(buildout + " -n") >>> print system(buildout + " -n")
Unused options for buildout: 'bar' 'foo'. Unused options for buildout: 'bar' 'foo'.
(XXX We patch download utility's API to produce readable output for the test; (XXX We patch download utility's API to produce readable output for the test;
a better solution would utilise the logging already done by the utility.) a better solution would utilise the logging already done by the utility.)
As one can see, even if profile is prefixed with ../ the canocial path is
calculated. Thanks to this paths for complex extend trees are downloaded only
once.
>>> import zc.buildout >>> import zc.buildout
>>> old_download = zc.buildout.download.Download.download >>> old_download = zc.buildout.download.Download.download
>>> def wrapper_download(self, url, md5sum=None, path=None): >>> def wrapper_download(self, url, md5sum=None, path=None):
...@@ -487,6 +504,8 @@ The URL http://localhost/baseA.cfg was downloaded. ...@@ -487,6 +504,8 @@ The URL http://localhost/baseA.cfg was downloaded.
The URL http://localhost/base.cfg was downloaded. The URL http://localhost/base.cfg was downloaded.
The URL http://localhost/baseB.cfg was downloaded. The URL http://localhost/baseB.cfg was downloaded.
The URL http://localhost/baseC.cfg was downloaded. The URL http://localhost/baseC.cfg was downloaded.
The URL http://localhost/deeper/base.cfg was downloaded.
The URL http://localhost/baseD.cfg was downloaded.
Unused options for buildout: 'bar' 'foo'. Unused options for buildout: 'bar' 'foo'.
>>> zc.buildout.download.Download.download = old_download >>> zc.buildout.download.Download.download = old_download
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment