summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-08-30 23:18:41 +0200
committerMichał Górny <mgorny@gentoo.org>2020-08-30 23:18:41 +0200
commit46931b9604bec354b927cc2e0f66e0e8b923e2b6 (patch)
treecc2d51254da8677a0ab97b51afd373d5cf25cd4c
parentbf9dcaad54420025a54364570ff64ff199364265 (diff)
downloadgemato-46931b9604bec354b927cc2e0f66e0e8b923e2b6.tar.gz
profile: Put profile names inside the eclasses
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--gemato/profile.py17
1 files 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):