aboutsummaryrefslogtreecommitdiff
path: root/lib/python/enigma_py_patcher.py
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-19 02:12:57 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-19 02:12:57 +0000
commited40f6f85c9c07c3c1224ae20601082c0309a631 (patch)
tree4082515a3e85107bd4a278b6613857b58da1770f /lib/python/enigma_py_patcher.py
parentb3658b04216ed3974047b4c4ec885ee0161d9267 (diff)
downloadenigma2-ed40f6f85c9c07c3c1224ae20601082c0309a631.tar.gz
enigma2-ed40f6f85c9c07c3c1224ae20601082c0309a631.zip
some python import cleanups
lesser swig overhead
Diffstat (limited to 'lib/python/enigma_py_patcher.py')
-rw-r--r--lib/python/enigma_py_patcher.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/python/enigma_py_patcher.py b/lib/python/enigma_py_patcher.py
new file mode 100644
index 00000000..52f9d232
--- /dev/null
+++ b/lib/python/enigma_py_patcher.py
@@ -0,0 +1,43 @@
+#read the comment to this file in lib/service/iservice.h !!
+
+import os
+
+os.rename("enigma.py", "enigma.py.org")
+
+source=open("enigma.py.org", "r")
+dest=open("enigma.py", "w")
+
+line=1
+for str in source.readlines():
+ oldstr = str[:]
+ str = str.replace('_ENUMS)', ')')
+ str = str.replace('_REPLACE)', ')')
+
+ pos = str.find('_ENUMS')
+ if pos != -1:
+ spacepos = pos
+ while spacepos > 0 and str[spacepos] != ' ':
+ spacepos -= 1
+ tmpstr = str[spacepos:pos]
+ if tmpstr.find('_enigma.') == -1:
+ str = str[:pos]+str[pos+6:]
+
+ pos = str.find('_REPLACE')
+ if pos != -1:
+ spacepos = pos
+ while spacepos > 0 and str[spacepos] != ' ':
+ spacepos -= 1
+ tmpstr = str[spacepos:pos]
+ if tmpstr.find('_enigma.') == -1:
+ str = str[:pos]+str[pos+8:]
+
+
+ if oldstr != str:
+ print "!!! Patch enigma.py line %d\n%s\n%s" %(line, oldstr[:len(oldstr)-1], str)
+
+ dest.write(str)
+ line += 1
+
+del source
+del dest
+os.remove("enigma.py.org")