Beispiel #1
0
	def _update_target (self, path):
		path = self.resolve(path)

		fs = self._db[self.build_path + self.__class__.__name__ + 'files']
		fs[path]= {'size': os.stat(path).st_size, 'hash': util.file_hash(path)}
		self._db[self.build_path + self.__class__.__name__ + 'files'] = fs
		return self
Beispiel #2
0
	def _update_target (self, path):
		path = self.resolve(path)

		fs = self._db[self.build_path + self.__class__.__name__ + 'files']
		fs[path]= {'size': os.stat(path).st_size, 'hash': util.file_hash(path)}
		self._db[self.build_path + self.__class__.__name__ + 'files'] = fs
		return self
Beispiel #3
0
	def _process_deps (self, force_rebuild = False):
		changed_targets = set()

		old_files = self._db.get(self.build_path + self.__class__.__name__ + 'files', {})
		# print old_files
		old_deps = self._db.get(self.build_path + self.__class__.__name__ + 'deps', {})

		cur_files = {}
		# print self._tmp_deps
		for path in self._tmp_files:
			# print self, path
			try:
				cur_size = os.stat(path).st_size
				cur_hash = util.file_hash(path)
				cur_files[path] = {'size': cur_size, 'hash': cur_hash}
			except OSError as e:
				if e.errno == errno.ENOENT:
					self.on_changed(path, changed_targets, self._print_ood)
				else:
					raise
			else:
				old_file = old_files.get(path)
				if force_rebuild or (not old_file) or (old_file['size'] != cur_size) or (old_file['hash'] != cur_hash):
					self.on_changed(path, changed_targets, self._print_ood)

		if changed_targets:
			self._db[self.build_path + self.__class__.__name__ + 'files'] = cur_files #TODO no need for ns here?
			self._db[self.build_path + self.__class__.__name__ + 'deps'] = self._tmp_deps

		return changed_targets
Beispiel #4
0
	def _process_deps (self, force_rebuild = False):
		changed_targets = set()

		def on_changed (path, changed_targets=changed_targets):
			if self._print_ood:
				logger.info("out-of-date: " + path)
			# print self._tmp_deps[path]
			changed_targets |= self._tmp_deps[path]

		old_files = self._db.get(self.build_path + self.__class__.__name__ + 'files', {})
		# print old_files
		old_deps = self._db.get(self.build_path + self.__class__.__name__ + 'deps', {})

		cur_files = {}
		# print self._tmp_deps
		for path in self._tmp_files:
			# print path
			try:
				cur_size = os.stat(path).st_size
				cur_hash = util.file_hash(path)
				cur_files[path] = {'size': cur_size, 'hash': cur_hash}
			except OSError as e:
				if e.errno == errno.ENOENT:
					on_changed(path)
				else:
					raise
			else:
				old_file = old_files.get(path)
				if force_rebuild or (not old_file) or (old_file['size'] != cur_size) or (old_file['hash'] != cur_hash):
					on_changed(path)

		if changed_targets:
			self._db[self.build_path + self.__class__.__name__ + 'files'] = cur_files #TODO no need for ns here?
			self._db[self.build_path + self.__class__.__name__ + 'deps'] = self._tmp_deps

		return changed_targets