Merge pull request #7237 from hulu/avoid-pip-shadowing

avoid shadowing `version()` in pip.list_()
This commit is contained in:
Thomas S Hatch 2013-09-13 22:17:21 -07:00
commit 302e317542

View File

@ -771,19 +771,19 @@ def list_(prefix=None,
continue continue
elif line.startswith('-e'): elif line.startswith('-e'):
line = line.split('-e ')[1] line = line.split('-e ')[1]
version, name = line.split('#egg=') version_, name = line.split('#egg=')
elif len(line.split('==')) >= 2: elif len(line.split('==')) >= 2:
name = line.split('==')[0] name = line.split('==')[0]
version = line.split('==')[1] version_ = line.split('==')[1]
else: else:
logger.error("Can't parse line '%s'", line) logger.error("Can't parse line '%s'", line)
continue continue
if prefix: if prefix:
if name.lower().startswith(prefix.lower()): if name.lower().startswith(prefix.lower()):
packages[name] = version packages[name] = version_
else: else:
packages[name] = version packages[name] = version_
return packages return packages