From 437e524ae4375a98c98195e201a6401cbcafbcd9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 30 Apr 2009 21:27:40 +0000 Subject: created find_pdexe() to support different directory layouts; made detection of end of patch more resilient svn path=/trunk/; revision=11209 --- scripts/load_every_help.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/load_every_help.py b/scripts/load_every_help.py index edfc8dab..1c7bbdc9 100755 --- a/scripts/load_every_help.py +++ b/scripts/load_every_help.py @@ -8,15 +8,20 @@ except IndexError: print 'only one arg: root dir of pd' sys.exit(2) - -bindir = pdrootdir + '/bin' -docdir = pdrootdir + '/doc' -pdexe = bindir + '/pd' -pdsendexe = bindir + '/pdsend' - PORT = 55555 netreceive_patch = '/tmp/.____pd_netreceive____.pd' +def find_pdexe(rootdir): + # start with the Windows/Mac OS X location + exe = pdrootdir + '/bin/pd' + if not os.path.isfile(exe): + # try the GNU/Linux location + exe = pdrootdir+'../../bin/pd' + if not os.path.isfile(exe): + print "ERROR: can't find pd executable" + exit + return os.path.realpath(exe) + def make_netreceive_patch(filename): fd = open(filename, 'w') @@ -51,6 +56,7 @@ def close_patch(filename): def launch_pd(): + pdexe = find_pdexe(pdrootdir) p = subprocess.Popen([pdexe, '-nogui', '-stderr', '-open', netreceive_patch], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True); @@ -114,6 +120,7 @@ def remove_ignorelines(list): make_netreceive_patch(netreceive_patch) logoutput = [] +docdir = pdrootdir + '/doc' for root, dirs, files in os.walk(docdir): #dirs.remove('.svn') # print "root: " + root @@ -128,10 +135,13 @@ for root, dirs, files in os.walk(docdir): close_patch(patch) quit_pd(p) patchoutput = [] - line = p.stdout.readline() - while line != 'EOF on socket 10\n': - patchoutput.append(line) + while True: line = p.stdout.readline() + m = re.search('EOF on socket', line) + if not m: + patchoutput.append(line) + else: + break patchoutput = remove_ignorelines(patchoutput) if len(patchoutput) > 0: # print 'found log messages: ' + name -- cgit v1.2.1