From d2fdcff2b490f6069ba5eb3d99766f934e8c78f4 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 13 May 2015 10:56:42 +0200 Subject: [PATCH] Remove follow_output.py --- scripts/follow_output.py | 73 ---------------------------------------- 1 file changed, 73 deletions(-) delete mode 100755 scripts/follow_output.py diff --git a/scripts/follow_output.py b/scripts/follow_output.py deleted file mode 100755 index 06fc4336..00000000 --- a/scripts/follow_output.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -import time -import os -import sys - -"""Follow the output files in standard output""" - -class OutputFollower(object): - - def __init__(self,filename): - self.filename = filename - self.dir = filename+'/output/' - while not os.path.exists(self.dir): - time.sleep(.1) - self.last_time = {} - self.last_line = {} - self.data = {} - self.update_file_list() - self.running = False - - def update_file_list(self): - self.file_list = filter(lambda x: x.endswith('.rst'), os.listdir(self.dir) ) - for filename in self.file_list: - filename = self.dir+'/'+filename - statbuf = os.stat(filename) - date = statbuf.st_mtime - if filename not in self.last_time: - self.last_time[filename] = -1 - self.last_line[filename] = -1 - self.data[filename] = [] - if date > self.last_time[filename]: - # Read file - file = open(filename,'r') - self.data[filename] = file.read().splitlines() - file.close() - # Print new lines - output = self.data[filename] - for line in output[self.last_line[filename]+1:]: - print line - self.last_time[filename] = date - self.last_line[filename] = len(output)-1 - - def start(self): - self.running = True - while self.running: - time.sleep(.1) - self.update_file_list() - - -def main(): - F = OutputFollower(sys.argv[1]) - - # Handle signals - import signal - def handler(signum,frame): - if F.running: - F.running = False - else: - sys.exit(0) - - for i in [2, 15]: - try: - signal.signal(i, handler) - except: - pass - - F.start() - -if __name__ == '__main__': - main() - -