def hash(file_name): try: with open(file_name, 'rb') as hashable: algo = hashlib.new(bit.options.hash_type) algo.update(hashable.read()) return algo.hexdigest() except IOError: error('Could not hash: {0}'.format(file_name))
def run(self): for function in self.build_steps: return_value = function() if return_value: error('Error: {0}'.format(return_value)) break self.write_deps() del self.database return 0
def rebuild(self): database_path = '.bit/{0}'.format(self.project_name) if os.path.exists(database_path): try: shutil.rmtree(database_path) except OSError: error('Could not remove database/configuration folder!') else: warning('No database folder found.') return 0
def run(self): self.set_options() os.chdir(self.project_directory) start_time = datetime.now() for function in self.build_steps: return_value = function() if not return_value == 0: # This line breaks so much I HAD to put in the == 0 :/ error('Error: {0}'.format(return_value)) sys.exit(return_value) end_time = datetime.now() info('{0}|{1}: {2}'.format(self.name.upper(), self.project_name, (end_time - start_time))) return 0