def _get_fetch_resume_size(settings, default='350K'):
key = 'PORTAGE_FETCH_RESUME_MIN_SIZE'
- v = settings.get(key)
+ v = settings.get(key, default)
if v is not None:
v = "".join(v.split())
- if not v:
- # If it's empty, silently use the default.
- v = default
- match = _fetch_resume_size_re.match(v)
- if (match is None or
- match.group(2).upper() not in _size_suffix_map):
- writemsg(_("!!! Variable %s contains an "
- "unrecognized format: '%s'\n")
- % (key, settings[key]),
- noiselevel=-1)
- writemsg(_("!!! Using %s default value: %s\n")
- % (key, default),
- noiselevel=-1)
- v = None
- if v is None:
+ if not v:
+ # If it's empty, silently use the default.
+ v = default
+ match = _fetch_resume_size_re.match(v)
+ if (match is None or
+ match.group(2).upper() not in _size_suffix_map):
+ writemsg(_("!!! Variable %s contains "
+ "an unrecognized format: '%s'\n")
+ % (key, settings[key]),
+ noiselevel=-1)
+ writemsg(_("!!! Using %s default value: %s\n")
+ % (key, default),
+ noiselevel=-1)
v = default
match = _fetch_resume_size_re.match(v)
v = int(match.group(1)) * \