From 44f7eff1b73eb331768ae5c6800bc76d890eb80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 2 Feb 2021 10:59:08 +0100 Subject: [PATCH] Move UnsignedPackagesError to a separate file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file can contain all Pungi specific exceptions. It should also fix an issue encountered on Python 2.7: AttributeError: 'module' object has no attribute 'pkgsets' Signed-off-by: Lubomír Sedlář --- pungi/errors.py | 20 ++++++++++++++++++++ pungi/phases/pkgset/pkgsets.py | 5 +---- pungi/scripts/pungi_koji.py | 3 ++- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 pungi/errors.py diff --git a/pungi/errors.py b/pungi/errors.py new file mode 100644 index 00000000..093c2c83 --- /dev/null +++ b/pungi/errors.py @@ -0,0 +1,20 @@ +# -*- 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 . + + +class UnsignedPackagesError(RuntimeError): + """Raised when package set fails to find a properly signed copy of an + RPM.""" + + pass diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 7d39d8c3..d4320865 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -33,10 +33,7 @@ from kobo.threads import WorkerThread, ThreadPool import pungi.wrappers.kojiwrapper from pungi.util import pkg_is_srpm, copy_all from pungi.arch import get_valid_arches, is_excluded - - -class UnsignedPackagesError(RuntimeError): - pass +from pungi.errors import UnsignedPackagesError class ExtendedRpmWrapper(kobo.pkgset.SimpleRpmWrapper): diff --git a/pungi/scripts/pungi_koji.py b/pungi/scripts/pungi_koji.py index 2a08840f..1e631718 100644 --- a/pungi/scripts/pungi_koji.py +++ b/pungi/scripts/pungi_koji.py @@ -21,6 +21,7 @@ from six.moves import shlex_quote from pungi.phases import PHASES_NAMES from pungi import get_full_version, util +from pungi.errors import UnsignedPackagesError # force C locales @@ -335,7 +336,7 @@ def main(): latest_link_status=latest_link_status, latest_link_components=latest_link_components, ) - except pungi.phases.pkgset.pkgsets.UnsignedPackagesError: + except UnsignedPackagesError: # There was an unsigned package somewhere. It is not safe to reuse any # package set from this compose (since we could leak the unsigned # package). Let's make sure all reuse files are deleted.