From de97d4dd76f4e1039a648bd092443cf41d363c3f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 20 Dec 2007 13:34:29 +0000 Subject: Fix portdbapi.cp_list() so that it can cope with a missing profile. svn path=/main/trunk/; revision=8990 --- pym/portage/dbapi/__init__.py | 1 + pym/portage/dbapi/porttree.py | 5 ++++- pym/portage/dbapi/vartree.py | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index c6318bacb..a1de0695f 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -13,6 +13,7 @@ from portage.versions import catpkgsplit, catsplit, pkgcmp class dbapi(object): + _category_re = re.compile(r'^[+\w][-\.+\w]*$') def __init__(self): pass diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index c8e8be56c..70176c6f7 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -513,7 +513,10 @@ class portdbapi(dbapi): self.xcache["match-all"][mycp] = cachelist return cachelist[:] mysplit = mycp.split("/") - invalid_category = mysplit[0] not in self._categories + if self.mysettings.profile_path: + invalid_category = mysplit[0] not in self._categories + else: + invalid_category = not self._category_re.match(mysplit[0]) d={} if mytree: mytrees = [mytree] diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 3ced505f7..9c4d99277 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -165,7 +165,6 @@ class LibraryPackageMap(object): mapfile.close() class vardbapi(dbapi): - _category_re = re.compile(r'^[+\w][-\.+\w]*$') def __init__(self, root, categories=None, settings=None, vartree=None): self.root = root[:] -- cgit v1.2.3-1-g7c22