+ def write(self, filename, section, package):
+ """
+ enqueue content to be written to the file on a separate thread
+ """
+ self.queue.put((filename,section,package))
+
+ def write_thread(self):
+ """
+ the target of a Thread which will do the actual writing
+ """
+ while True:
+ next = self.queue.get()
+ if isinstance(next, EndOfContents):
+ self.output.write('\n')
+ self.output.close()
+ break
+
+ (filename,section,package)=next
+ if next != self.current_file:
+ # this is the first file, so write the header first
+ if not self.current_file:
+ self.output.write(self._getHeader())
+
+ self.output.write('\n%s\t' % filename)
+ self.first_package = True
+
+ self.current_file=filename
+
+ if not self.first_package:
+ self.output.write(',')
+ else:
+ self.first_package=False
+ self.output.write('%s/%s' % (section,package))
+
+ def finish(self):
+ """
+ enqueue the sentry object so that writers will know to terminate
+ """
+ self.queue.put(EndOfContents())
+
+ @classmethod