InstalledPackageInfo: исправлено ошибка декодирования получения параметров из environments

master 3.7.1.12
Mike Hiretsky 3 years ago
parent 3d8e0d1aec
commit 4dd593444a

@ -1412,8 +1412,8 @@ class InstalledPackageInfo():
""" """
depend_pattern = 'declare (?:-x )?({0})="([^"]+)"' depend_pattern = 'declare (?:-x )?({0})="([^"]+)"'
re_depend = re.compile(depend_pattern.format( re_depend = re.compile(depend_pattern.format(
"|".join(EbuildInfo.support_keys)), re.DOTALL) "|".join(EbuildInfo.support_keys)).encode('UTF-8'), re.DOTALL)
re_multispace = re.compile("\s+", re.DOTALL) re_multispace = re.compile(b"\s+", re.DOTALL)
def __init__(self, atom, pkg_dir): def __init__(self, atom, pkg_dir):
self.atom = atom self.atom = atom
@ -1427,10 +1427,10 @@ class InstalledPackageInfo():
env_path = path.join(self._pkg_path, 'environment.bz2') env_path = path.join(self._pkg_path, 'environment.bz2')
if path.exists(env_path): if path.exists(env_path):
with bz2.BZ2File(env_path, 'r') as f: with bz2.BZ2File(env_path, 'r') as f:
for r in self.re_depend.finditer(f.read().decode("UTF-8")): for r in self.re_depend.finditer(f.read()):
key, value = r.groups() key, value = r.groups()
value = self.re_multispace.sub(" ", value) value = self.re_multispace.sub(b" ", value)
info[key] = value.strip() info[key.decode('UTF-8')] = value.strip().decode('UTF-8')
rep_path = path.join(self._pkg_path, 'repository') rep_path = path.join(self._pkg_path, 'repository')
info['repository'] = readFile(rep_path).strip() info['repository'] = readFile(rep_path).strip()
return EbuildInfo.prepare_use_flags(info) return EbuildInfo.prepare_use_flags(info)

Loading…
Cancel
Save