Commit bb8f7784 authored by Reinout van Rees's avatar Reinout van Rees

Renamed cached_filename to downloaded_filename

Reason: it doesn't only apply to URLs downloaded to the extends-cache, but
also to URLs downloaded as tempfiles.
parent 38ccb6f8
...@@ -1570,10 +1570,10 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1570,10 +1570,10 @@ def _open(base, filename, seen, dl_options, override, downloaded):
_dl_options, cache=_dl_options.get('extends-cache'), _dl_options, cache=_dl_options.get('extends-cache'),
fallback=fallback, hash_name=True) fallback=fallback, hash_name=True)
is_temp = False is_temp = False
cached_filename = None downloaded_filename = None
if _isurl(filename): if _isurl(filename):
cached_filename, is_temp = download(filename) downloaded_filename, is_temp = download(filename)
fp = open(cached_filename) fp = open(downloaded_filename)
base = filename[:filename.rfind('/')] base = filename[:filename.rfind('/')]
elif _isurl(base): elif _isurl(base):
if os.path.isabs(filename): if os.path.isabs(filename):
...@@ -1581,8 +1581,8 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1581,8 +1581,8 @@ def _open(base, filename, seen, dl_options, override, downloaded):
base = os.path.dirname(filename) base = os.path.dirname(filename)
else: else:
filename = base + '/' + filename filename = base + '/' + filename
cached_filename, is_temp = download(filename) downloaded_filename, is_temp = download(filename)
fp = open(cached_filename) fp = open(downloaded_filename)
base = filename[:filename.rfind('/')] base = filename[:filename.rfind('/')]
else: else:
filename = os.path.join(base, filename) filename = os.path.join(base, filename)
...@@ -1593,21 +1593,22 @@ def _open(base, filename, seen, dl_options, override, downloaded): ...@@ -1593,21 +1593,22 @@ def _open(base, filename, seen, dl_options, override, downloaded):
if filename in seen: if filename in seen:
if is_temp: if is_temp:
fp.close() fp.close()
os.remove(cached_filename) os.remove(downloaded_filename)
raise zc.buildout.UserError("Recursive file include", seen, filename) raise zc.buildout.UserError("Recursive file include", seen, filename)
root_config_file = not seen root_config_file = not seen
seen.append(filename) seen.append(filename)
filename_for_logging = filename filename_for_logging = filename
if cached_filename: if downloaded_filename:
filename_for_logging = '%s (cached at %s)' % (filename, cached_filename) filename_for_logging = '%s (cached at %s)' % (
filename, downloaded_filename)
result = zc.buildout.configparser.parse( result = zc.buildout.configparser.parse(
fp, filename_for_logging, _default_globals) fp, filename_for_logging, _default_globals)
fp.close() fp.close()
if is_temp: if is_temp:
os.remove(cached_filename) os.remove(downloaded_filename)
options = result.get('buildout', {}) options = result.get('buildout', {})
extends = options.pop('extends', None) extends = options.pop('extends', None)
......
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