Bug-Fix: "local variable 'distro' referenced before assignment" error in PackageInfo (LP: #623639)

This commit is contained in:
Terence Simpson 2010-11-19 14:11:23 +00:00
parent 5ed4e67b07
commit fb70eb9e5d

View File

@ -83,10 +83,9 @@ class Apt:
if not pkg.strip():
return ''
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum() or x in '.-_+'])
distro = chkdistro
if len(pkg.strip().split()) > 1:
distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum() or x in '-._+'])
if not distro:
distro = chkdistro
if distro not in self.distros:
return "%r is not a valid distribution: %s" % (distro, ", ".join(self.distros))