From fda707c9214995742fc6b7bc765e0ad3f27fad34 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sat, 6 Nov 2010 22:24:12 +0100 Subject: [PATCH] Calculate path to package.mask file only once per profile. --- pym/portage/package/ebuild/getmaskingreason.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pym/portage/package/ebuild/getmaskingreason.py b/pym/portage/package/ebuild/getmaskingreason.py index 83757b798..c0746d0f2 100644 --- a/pym/portage/package/ebuild/getmaskingreason.py +++ b/pym/portage/package/ebuild/getmaskingreason.py @@ -44,7 +44,10 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo locations.append(os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH)) locations.reverse() - pmasklists = [(x, grablines(os.path.join(x, "package.mask"), recursive=1)) for x in locations] + pmasklists = [] + for profile in locations: + pmask_filename = os.path.join(profile, "package.mask") + pmasklists.append((pmask_filename, grablines(pmask_filename, recursive=1))) pmaskdict = settings._mask_manager._pmaskdict if mycp in pmaskdict: @@ -54,7 +57,7 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo for pmask in pmasklists: comment = "" comment_valid = -1 - pmask_filename = os.path.join(pmask[0], "package.mask") + pmask_filename = pmask[0] for i in range(len(pmask[1])): l = pmask[1][i].strip() try: @@ -76,7 +79,7 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo else: return comment elif comment_valid != -1: - # Apparently this comment applies to muliple masks, so + # Apparently this comment applies to multiple masks, so # it remains valid until a blank line is encountered. comment_valid += 1 if return_location: -- 2.26.2