Move data classes into britney2/__init__.py

Signed-off-by: Niels Thykier <niels@thykier.net>
email-direct-upload-sponsor
Niels Thykier 8 years ago
parent 4eb5bdb396
commit 9c563f1a96

@ -185,7 +185,7 @@ import optparse
import os import os
import sys import sys
import time import time
from collections import defaultdict, namedtuple from collections import defaultdict
from functools import reduce from functools import reduce
from itertools import product from itertools import product
from operator import attrgetter from operator import attrgetter
@ -194,6 +194,7 @@ from urllib.parse import quote
import apt_pkg import apt_pkg
# Check the "check_field_name" reflection before removing an import here. # 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.consts import (SOURCE, SOURCEVER, ARCHITECTURE, CONFLICTS, DEPENDS, PROVIDES, MULTIARCH)
from britney2.excuse import Excuse from britney2.excuse import Excuse
from britney2.hints import HintParser 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) 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): class Britney(object):
"""Britney, the Debian testing updater script """Britney, the Debian testing updater script

@ -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',
])
Loading…
Cancel
Save