diff --git a/britney.py b/britney.py index 6d8361a..99463f3 100755 --- a/britney.py +++ b/britney.py @@ -185,7 +185,7 @@ import optparse import os import sys import time -from collections import defaultdict, namedtuple +from collections import defaultdict from functools import reduce from itertools import product from operator import attrgetter @@ -194,6 +194,7 @@ from urllib.parse import quote import apt_pkg # Check the "check_field_name" reflection before removing an import here. +from britney2 import SuiteInfo, SourcePackage, BinaryPackageId, BinaryPackage from britney2.consts import (SOURCE, SOURCEVER, ARCHITECTURE, CONFLICTS, DEPENDS, PROVIDES, MULTIARCH) from britney2.excuse import Excuse from britney2.hints import HintParser @@ -227,47 +228,6 @@ check_field_name = dict((globals()[fn], fn) for fn in check_fields = sorted(check_field_name) -class SourcePackage(object): - - __slots__ = ['version', 'section', 'binaries', 'maintainer', 'is_fakesrc'] - - def __init__(self, version, section, binaries, maintainer, is_fakesrc): - self.version = version - self.section = section - self.binaries = binaries - self.maintainer = maintainer - self.is_fakesrc = is_fakesrc - - def __getitem__(self, item): - return getattr(self, self.__slots__[item]) - -BinaryPackageId = namedtuple('BinaryPackageId', [ - 'package_name', - 'version', - 'architecture', - ]) - -BinaryPackage = namedtuple('BinaryPackage', [ - 'version', - 'section', - 'source', - 'source_version', - 'architecture', - 'multi_arch', - 'depends', - 'conflicts', - 'provides', - 'is_essential', - 'pkg_id', - ]) - -SuiteInfo = namedtuple('SuiteInfo', [ - 'name', - 'path', - 'excuses_suffix', -]) - - class Britney(object): """Britney, the Debian testing updater script diff --git a/britney2/__init__.py b/britney2/__init__.py index e69de29..bc7a2cf 100644 --- a/britney2/__init__.py +++ b/britney2/__init__.py @@ -0,0 +1,42 @@ +from collections import namedtuple + +SuiteInfo = namedtuple('SuiteInfo', [ + 'name', + 'path', + 'excuses_suffix', +]) + + +class SourcePackage(object): + + __slots__ = ['version', 'section', 'binaries', 'maintainer', 'is_fakesrc'] + + def __init__(self, version, section, binaries, maintainer, is_fakesrc): + self.version = version + self.section = section + self.binaries = binaries + self.maintainer = maintainer + self.is_fakesrc = is_fakesrc + + def __getitem__(self, item): + return getattr(self, self.__slots__[item]) + +BinaryPackageId = namedtuple('BinaryPackageId', [ + 'package_name', + 'version', + 'architecture', +]) + +BinaryPackage = namedtuple('BinaryPackage', [ + 'version', + 'section', + 'source', + 'source_version', + 'architecture', + 'multi_arch', + 'depends', + 'conflicts', + 'provides', + 'is_essential', + 'pkg_id', +])