diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2009-04-30 21:27:40 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2009-04-30 21:27:40 +0000 |
commit | 437e524ae4375a98c98195e201a6401cbcafbcd9 (patch) | |
tree | e88188735fa287aa067499ea1ff56e21a4eb2e64 | |
parent | 61074d374dc828ff5af9a2affa866ee4bbe3f504 (diff) |
created find_pdexe() to support different directory layouts; made detection of end of patch more resilient
svn path=/trunk/; revision=11209
-rwxr-xr-x | scripts/load_every_help.py | 28 |
1 files changed, 19 insertions, 9 deletions
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 |