From 46931b9604bec354b927cc2e0f66e0e8b923e2b6 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sun, 30 Aug 2020 23:18:41 +0200 Subject: profile: Put profile names inside the eclasses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- gemato/profile.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gemato/profile.py b/gemato/profile.py index 0e26a28..e5b063e 100644 --- a/gemato/profile.py +++ b/gemato/profile.py @@ -13,6 +13,8 @@ class DefaultProfile: correct behavior for a given use case. """ + name = 'default' + def set_loader_options(self, loader): """ Alter loader @loader with profile-specific options. This @@ -75,6 +77,8 @@ class EbuildRepositoryProfile(DefaultProfile): A profile suited for a modern ebuild repository. """ + name = 'ebuild' + def want_manifest_in_directory(self, relpath, dirnames, filenames): # a quick way to catch most of packages and ::gentoo categories if 'metadata.xml' in filenames: @@ -138,6 +142,8 @@ class BackwardsCompatEbuildRepositoryProfile(EbuildRepositoryProfile): with Manifest2 format. """ + name = 'old-ebuild' + def get_entry_type_for_path(self, path): spl = path.split(os.path.sep) if len(spl) == 3: @@ -164,11 +170,12 @@ class BackwardsCompatEbuildRepositoryProfile(EbuildRepositoryProfile): compress_watermark)) -PROFILE_MAPPING = { - 'default': DefaultProfile, - 'ebuild': EbuildRepositoryProfile, - 'old-ebuild': BackwardsCompatEbuildRepositoryProfile, -} +PROFILE_MAPPING = dict( + (getattr(profile, 'name'), profile) + for profile in (DefaultProfile, + EbuildRepositoryProfile, + BackwardsCompatEbuildRepositoryProfile, + )) def get_profile_by_name(name): -- cgit v1.2.3