aboutsummaryrefslogtreecommitdiff
path: root/scripts/insert_declare.py
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-08-14 17:41:19 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-08-14 17:41:19 +0000
commit8e4cc7c19066c82a091dc66bd8ce79bce16e830d (patch)
treefa125c2ca08ed43f3cd10408039e6e65f57cd803 /scripts/insert_declare.py
parent5466d3284b7a2685c1e0d120b47b3fe2ecd550b5 (diff)
merged in changes from the v0-40 pd-extended release branch
svn path=/trunk/; revision=10244
Diffstat (limited to 'scripts/insert_declare.py')
-rwxr-xr-xscripts/insert_declare.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/insert_declare.py b/scripts/insert_declare.py
new file mode 100755
index 00000000..025d0a23
--- /dev/null
+++ b/scripts/insert_declare.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+import string
+import os,sys
+import re
+import StringIO
+
+library = os.getcwd().split('/')[-1]
+
+print "current library: " + library + "\n"
+
+for root, dirs, files in os.walk('.'):
+ dirs.remove('.svn')
+# print "root: " + root
+ for name in files:
+ m = re.search(".*-help\.pd$", name)
+ if m:
+ helppatch = os.path.join(root, m.string)
+ fd = open(helppatch, 'r')
+ contents = fd.readlines()
+ fd.close()
+ firstline = contents[0]
+ contents.remove(firstline)
+# fd = open(helppatch + ".new", 'w')
+ print helppatch
+ fd = open(helppatch, 'w')
+ fd.write(firstline)
+ fd.write("#X declare -lib " + library.lower() + ";\n")
+ fd.writelines(contents)
+ fd.close()
+