def error_check(self):
        if not re.match('\d+$', self.rev) and self.rev != '':
            raise SyntaxError(messages.syn_error_revnum %
                              (self.rev, self.dir, self.file))
        if self.dir == '' and self.rev != '' or self.dir != '' and self.rev == '':
            raise LogicError(
                messages.logic_error_revdir.replace('\n', '') %
                (self.dir, self.file, self.rev, self.dir))

        SystemDirective.error_check(self)
示例#2
0
    def create_flag_list (self):
        self.flag_list = False
        if re.search('\*.+',self.linkedfile) or re.search('^.+\*',self.linkedfile) or (re.search('\*',self.localfile)):
            # Make wildcard list
            self.flag_list = True
            wildfirst,wildlast = self.linkedfile.split('*')
            self.LIST = []
            for element in os.listdir(self.linkeddir):
                if re.match('%s.*%s$' % (wildfirst,wildlast),element):
                    self.LIST.append(element.rstrip('\n'))       

        # Check wildcard directory non-empty
        if self.flag_list and not self.LIST:
            raise LogicError(messages.crit_error_emptylist)                    
    def error_check_local(self):
        # Check syntax
        if self.file == '' or self.outfile == '' or self.outdir == '':
            raise SyntaxError(messages.syn_error_noname)
        if not re.search('\*', self.file) and re.search('\*', self.outfile):
            raise SyntaxError(
                messages.syn_error_wildfilename1.replace('\n', ''))
        if re.search('\*',
                     self.outfile) and not re.search('\*$', self.outfile):
            raise SyntaxError(messages.syn_error_wildoutfile.replace('\n', ''))
        if len(re.findall('\*', self.outfile)) > 1:
            raise SyntaxError(messages.syn_error_wildoutfile.replace('\n', ''))

        # Check wildcard directory non-empty
        if self.flag_list and not self.LIST:
            raise LogicError(messages.crit_error_emptylist)
 def error_check_SVN(self):
     # Check that rev/dir are well-defined
     if self.dir == '' and self.rev == '':
         if self.last_rev == '' or self.last_dir == '':
             raise LogicError(messages.logic_error_firstrevdir)
    def check_revdir(self):
        if self.dir == '' and self.last_dir == '':
            raise LogicError(messages.logic_error_firstrevdir)

        SystemDirective.check_revdir(self)