def open(self): if not self.options.dbfile: self.options.parser.error('No filename list given') return False if not os.access(self.options.dbfile, os.R_OK): self.options.parser.error('Unable to open filename list %s' % self.options.dbfile) return False with open(self.options.dbfile, 'r') as f: for line in f: cleaned_file = line.strip().replace('/', '\\') base_fname = os.path.splitext(cleaned_file)[0] hash_value = jenkins.hashlittle2(cleaned_file.upper()) self.files[(hash_value[0] << 32) | hash_value[1]] = cleaned_file for ext in ['.db2', '.dbc']: final_file = base_fname + ext hash_value = jenkins.hashlittle2(final_file.upper()) self.files[(hash_value[0] << 32) | hash_value[1]] = final_file return True
def open(self): if not self.options.dbfile: print self.options.parser('No filename list given') return False if not os.access(self.options.dbfile, os.R_OK): print self.options.parser('Unable to open filename list %s' % self.options.dbfile) return False with open(self.options.dbfile, 'r') as f: for line in f: cleaned_file = line.strip().replace('/', '\\') base_fname = os.path.splitext(cleaned_file)[0] for ext in [ '.db2', '.dbc' ]: final_file = base_fname + ext hash_value = jenkins.hashlittle2(final_file.upper()) self.files[(hash_value[0] << 32) | hash_value[1]] = final_file return True
def GetFileMD5(self, file): hash_name = file.strip().upper().replace('/', '\\') hash = jenkins.hashlittle2(hash_name) v = (hash[0] << 32) | hash[1] return self.hash_map.get(v, [])