From 83458f26c27d21845071946f38c3587ea924bfa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 27 Jan 2021 15:41:33 +0100 Subject: [PATCH] pkgset: Drop kobo.plugins usage from GatherSources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relates: https://pagure.io/pungi/issue/1488 Signed-off-by: Lubomír Sedlář --- pungi/phases/gather/__init__.py | 5 +--- pungi/phases/gather/source.py | 11 +-------- pungi/phases/gather/sources/__init__.py | 26 ++++++++++++++++++++ pungi/phases/gather/sources/source_comps.py | 2 -- pungi/phases/gather/sources/source_json.py | 2 -- pungi/phases/gather/sources/source_module.py | 2 -- pungi/phases/gather/sources/source_none.py | 2 -- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index bf190335..96b6d9af 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -45,11 +45,8 @@ from pungi.phases.createrepo import add_modular_metadata def get_gather_source(name): import pungi.phases.gather.sources - from .source import GatherSourceContainer - GatherSourceContainer.register_module(pungi.phases.gather.sources) - container = GatherSourceContainer() - return container["GatherSource%s" % name] + return pungi.phases.gather.sources.ALL_SOURCES[name.lower()] def get_gather_method(name): diff --git a/pungi/phases/gather/source.py b/pungi/phases/gather/source.py index c1d7c9c5..92c15df1 100644 --- a/pungi/phases/gather/source.py +++ b/pungi/phases/gather/source.py @@ -14,15 +14,6 @@ # along with this program; if not, see . -import kobo.plugins - - -class GatherSourceBase(kobo.plugins.Plugin): +class GatherSourceBase(object): def __init__(self, compose): self.compose = compose - - -class GatherSourceContainer(kobo.plugins.PluginContainer): - @classmethod - def normalize_name(cls, name): - return name.lower() diff --git a/pungi/phases/gather/sources/__init__.py b/pungi/phases/gather/sources/__init__.py index e69de29b..00ff61e8 100644 --- a/pungi/phases/gather/sources/__init__.py +++ b/pungi/phases/gather/sources/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . + +from .source_comps import GatherSourceComps +from .source_json import GatherSourceJson +from .source_module import GatherSourceModule +from .source_none import GatherSourceNone + +ALL_SOURCES = { + "comps": GatherSourceComps, + "json": GatherSourceJson, + "module": GatherSourceModule, + "none": GatherSourceNone, +} diff --git a/pungi/phases/gather/sources/source_comps.py b/pungi/phases/gather/sources/source_comps.py index e9987dfe..e1247770 100644 --- a/pungi/phases/gather/sources/source_comps.py +++ b/pungi/phases/gather/sources/source_comps.py @@ -30,8 +30,6 @@ import pungi.phases.gather.source class GatherSourceComps(pungi.phases.gather.source.GatherSourceBase): - enabled = True - def __call__(self, arch, variant): groups = set() if not self.compose.conf.get("comps_file"): diff --git a/pungi/phases/gather/sources/source_json.py b/pungi/phases/gather/sources/source_json.py index 073935d8..2be88eb0 100644 --- a/pungi/phases/gather/sources/source_json.py +++ b/pungi/phases/gather/sources/source_json.py @@ -37,8 +37,6 @@ import pungi.phases.gather.source class GatherSourceJson(pungi.phases.gather.source.GatherSourceBase): - enabled = True - def __call__(self, arch, variant): json_path = self.compose.conf.get("gather_source_mapping") if not json_path: diff --git a/pungi/phases/gather/sources/source_module.py b/pungi/phases/gather/sources/source_module.py index beb108d2..be636bf0 100644 --- a/pungi/phases/gather/sources/source_module.py +++ b/pungi/phases/gather/sources/source_module.py @@ -26,8 +26,6 @@ import pungi.phases.gather.source class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase): - enabled = True - def __call__(self, arch, variant): groups = set() packages = set() diff --git a/pungi/phases/gather/sources/source_none.py b/pungi/phases/gather/sources/source_none.py index 35801e9f..a78b198a 100644 --- a/pungi/phases/gather/sources/source_none.py +++ b/pungi/phases/gather/sources/source_none.py @@ -29,7 +29,5 @@ import pungi.phases.gather.source class GatherSourceNone(pungi.phases.gather.source.GatherSourceBase): - enabled = True - def __call__(self, arch, variant): return set(), set()