summaryrefslogtreecommitdiff
path: root/mkspecs/pyfix.py
authorzecke <zecke>2004-07-18 19:32:20 (UTC)
committer zecke <zecke>2004-07-18 19:32:20 (UTC)
commit8795812a0d763742a5273f356c35313af0fed84d (patch) (side-by-side diff)
tree34b7259e1595e53e1fa2069d7d79bbdef67293e8 /mkspecs/pyfix.py
parent8e8fcd65b8d8657650728bae604c5a34dc31338e (diff)
downloadopie-8795812a0d763742a5273f356c35313af0fed84d.zip
opie-8795812a0d763742a5273f356c35313af0fed84d.tar.gz
opie-8795812a0d763742a5273f356c35313af0fed84d.tar.bz2
-CHECK if DIR exist added to qmake.conf's
-use arm-linux-g++ for linking now hopefully not removed anything important Added python tool to opiefy mkspecs
Diffstat (limited to 'mkspecs/pyfix.py') (more/less context) (show whitespace changes)
-rw-r--r--mkspecs/pyfix.py82
1 files changed, 82 insertions, 0 deletions
diff --git a/mkspecs/pyfix.py b/mkspecs/pyfix.py
new file mode 100644
index 0000000..7b86f42
--- a/dev/null
+++ b/mkspecs/pyfix.py
@@ -0,0 +1,82 @@
+import os
+
+# patch the following
+# QMAKE_CFLAGS add $(CFLAGS_EXTRA)
+# QMAKE_CXXFLAGS add $(CXXFLAGS_EXTRA)
+# QMAKE_LFLAGS add $(LFLAGS_EXTRA)
+# QMAKE_LIBS add $(LIBS_EXTRA)
+
+# QMAKE_CFLAGS_RELEASE include old argument
+#
+
+add_map = { "QMAKE_CFLAGS" : "$(CFLAGS_EXTRA)",
+ "QMAKE_CXXFLAGS" : "$(CXXFLAGS_EXTRA)",
+ "QMAKE_LFLAGS" : "$(LFLAGS_EXTRA)",
+ "QMAKE_LIBS" : "$(LIBS_EXTRA)" }
+
+rep_map = { "QMAKE_CFLAGS_RELEASE" : ["$(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE),", ")"] }
+
+
+def split_text(line):
+ """
+ SPlits the text in the form of "key = value"
+ and returns a two tuple-tuple
+ """
+ ## disabled strip and split tab stuff
+ left = line.find('=')
+ if left == -1:
+ raise Exception, "No src line"
+ key = line[0:left].strip()
+ val = line[left+1:].strip()
+ return (key,val)
+
+def apply_line(line):
+ """
+ Apply changes to a line. This will not handle the exception
+ thrown by split_text
+ """
+ key,val = split_text(line)
+
+ tabs = '\t'
+ if len(key) <= 14:
+ tabs = tabs + '\t'
+ spac = ''
+ if len(val) != 0:
+ spac = ' '
+
+ # for minimal changes on the file we've three returns
+ if add_map.has_key(key):
+ val = val + spac + add_map[key]
+ return key + tabs + '= ' + val + '\n'
+ elif rep_map.has_key(key):
+ val = rep_map[key][0] + ' ' + val + rep_map[key][1]
+ return key + tabs + '= ' + val + '\n'
+ return line
+
+
+
+def apply_on_file(fi):
+ """
+ Apply the maps on files
+ """
+ lines = []
+ for line in file(fi):
+ try:
+ line = apply_line(line)
+ except:
+ pass
+ lines.append(line)
+
+ f = file(fi,'w')
+ for line in lines:
+ f.write(line)
+
+def fix_it():
+ for root, dirs, files in os.walk('./mkspecs'):
+ for fil in files:
+ print root + '/' + fil
+ apply_on_file(root+'/'+fil)
+
+
+if __name__ == '__main__':
+ fix_it()