Package linda :: Package parser :: Module datavalidator
[hide private]

Source Code for Module linda.parser.datavalidator

 1  from linda.parser.arch import ArchParser 
 2   
3 -class DataValidator:
4 - def __init__(self, type, data):
5 self.data = data 6 self.value = 0 7 if hasattr(self, type): 8 if self.data is None: 9 self.value = 1 10 else: 11 getattr(self, type)()
12
13 - def __nonzero__(self):
14 return self.value
15
16 - def arch(self):
17 arches = ArchParser() 18 if self.data[0] == '!': 19 self.data = self.data[1:] 20 if arches.check(self.data): 21 self.value = 1
22
23 - def priority(self):
24 if self.data in ('required', 'important', 'standard', 'optional', \ 25 'extra'): 26 self.value = 1
27
28 - def section(self):
29 if self.data in ('admin', 'base', 'comm', 'contrib', 'devel', \ 30 'debian-installer', 'doc', 'editors', 'electronics', 'embedded', \ 31 'games', 'gnome', 'graphics', 'hamradio', 'interpreters', 'kde', \ 32 'libdevel', 'libs', 'mail', 'main', 'math', 'misc', 'net', \ 33 'news', 'non-US', 'non-free', 'oldlibs', 'otherosfs', 'perl', \ 34 'python', 'science', 'shells', 'sound', 'tex', 'text', 'utils', \ 35 'web', 'x11'): 36 self.value = 1
37
38 - def essential(self):
39 if self.data in ('ncurses-base', 'textutils', 'bsdutils', 'sed', \ 40 'base-passwd', 'util-linux', 'ncurses-bin', 'tar', 'gzip', \ 41 'dpkg', 'base-files', 'findutils', 'shellutils', 'grep', \ 42 'mount', 'e2fsprogs', 'sysvinit', 'perl-base', 'hostname', \ 43 'fileutils', 'login', 'diff', 'bash', 'debianutils'): 44 self.value = 1
45