summaryrefslogtreecommitdiffstats
path: root/postproc
diff options
context:
space:
mode:
Diffstat (limited to 'postproc')
-rwxr-xr-xpostproc78
1 files changed, 39 insertions, 39 deletions
diff --git a/postproc b/postproc
index 5c058e6..7445d8c 100755
--- a/postproc
+++ b/postproc
@@ -1,6 +1,6 @@
#!/usr/bin/python
-import sys, getopt, os, os.path, fnmatch, string, StringIO
+import sys, getopt, os, os.path, fnmatch, string, io
#---------- globals ----------
@@ -28,7 +28,7 @@ def getOptions ():
args = []
if (optlist == []) or (len (args) != 1):
- print '\nUsage: postproc -p<path> -o<operation> <filespec>\n'
+ print('\nUsage: postproc -p<path> -o<operation> <filespec>\n')
return FALSE
pattern = args [0]
@@ -41,13 +41,13 @@ def checkOptions (optlist):
for pair in optlist:
if (pair [0] == '--path') or (pair [0] == '-p'):
if not checkPath (pair [1]):
- print '\nPath ' + pair [1] + ' does not exist\n'
+ print('\nPath ' + pair [1] + ' does not exist\n')
else:
havePath = TRUE
elif (pair [0] == '--op') or (pair [0] == '-o'):
if not checkOp (pair [1]):
- print '\nOperation ' + pair [1] + ' does not exist\n'
+ print('\nOperation ' + pair [1] + ' does not exist\n')
else:
haveOp = TRUE
@@ -92,7 +92,7 @@ def trFix (filelist):
for fn in filelist:
m = open (opPath + fn, 'r')
tmpname = os.path.splitext (fn) [0] + '.tmp'
- tmp = StringIO.StringIO ()
+ tmp = io.StringIO ()
buff = m.readlines ()
m.close ()
@@ -106,7 +106,7 @@ def trFix (filelist):
i = i + 1
# find classname
- while (i < nLines) and (not string.find (buff [i], 'PyObject *sipClass_') == 0):
+ while (i < nLines) and (not buff[i].find('PyObject *sipClass_') == 0):
tmp.write (buff [i])
i = i + 1
@@ -135,7 +135,7 @@ def trFix (filelist):
while (i < nLines):
# skip sipName_qt_tr table entry/write out everything else
- if string.find (buff [i], '{sipName_qt_tr') < 0:
+ if buff[i].find('{sipName_qt_tr') < 0:
tmp.write (buff [i])
i = i + 1
@@ -152,7 +152,7 @@ def qtNoTr (filelist):
for fn in filelist:
m = open (opPath + fn, 'r')
tmpname = os.path.splitext (fn) [0] + '.tmp'
- tmp = StringIO.StringIO ()
+ tmp = io.StringIO ()
buff = m.readlines ()
m.close ()
@@ -160,7 +160,7 @@ def qtNoTr (filelist):
i = 0
nLines = len (buff)
- while (i < nLines) and (string.find (buff [i], 'Q_OBJECT') < 0):
+ while (i < nLines) and (buff[i].find('Q_OBJECT') < 0):
tmp.write (buff [i])
i = i + 1
@@ -189,7 +189,7 @@ def shpix ():
files = os.listdir (opPath)
fn = []
for file in files:
- if string.find (file, "tdeuipart") >= 0 and file [-4:] == ".cpp":
+ if file.find("tdeuipart") >= 0 and file [-4:] == ".cpp":
fn.append (file)
if not fn:
@@ -206,9 +206,9 @@ def shpix ():
state = None
for ln in range (0, len (buff)):
line = buff [ln]
- if string.find (line, "sipTDESharedPixmap::resolution") >= 0:
+ if line.find("sipTDESharedPixmap::resolution") >= 0:
state = "res"
- elif string.find (line, "sipTDESharedPixmap::setResolution") >= 0:
+ elif line.find("sipTDESharedPixmap::setResolution") >= 0:
state = "setRes"
else:
state = None
@@ -219,9 +219,9 @@ def shpix ():
ln = ln + 1
line = buff [ln]
if state == "res":
- buff [ln] = string.replace (line, "TQPaintDevice::resolution", "KPixmap::resolution")
+ buff [ln] = line.replace("TQPaintDevice::resolution", "KPixmap::resolution")
elif state == "setRes":
- buff [ln] = string.replace (line, "TQPaintDevice::setResolution", "KPixmap::setResolution")
+ buff [ln] = line.replace("TQPaintDevice::setResolution", "KPixmap::setResolution")
tmpfile = open (os.path.join (opPath, tmpname), 'w')
for line in buff:
@@ -244,13 +244,13 @@ def notify ():
tmpBuff = []
flag = 0
for line in buff:
- if string.find (line, "class KNotify:") >= 0:
+ if line.find("class KNotify:") >= 0:
flag = 1
- elif flag == 1 and string.find (line, "class KNotifyWidgetBase(TQWidget):") >= 0:
+ elif flag == 1 and line.find("class KNotifyWidgetBase(TQWidget):") >= 0:
flag = 2
- elif flag == 2 and string.find (line, "class KNotifyWidget(KNotifyWidgetBase):") >= 0:
+ elif flag == 2 and line.find("class KNotifyWidget(KNotifyWidgetBase):") >= 0:
for ln in tmpBuff:
tmpfile.write (ln)
flag = 0
@@ -270,7 +270,7 @@ def varhier (filelist):
for fn in filelist:
m = open (opPath + fn, 'r')
tmpname = os.path.splitext (fn) [0] + '.tmp'
- tmp = StringIO.StringIO ()
+ tmp = io.StringIO ()
buff = m.readlines ()
m.close ()
@@ -278,11 +278,11 @@ def varhier (filelist):
i = 0
nLines = len (buff)
- while (i < nLines) and (string.find (buff [i], 'PyMethodDef *sipClassVarHierTab_') < 0):
+ while (i < nLines) and (buff[i].find('PyMethodDef *sipClassVarHierTab_') < 0):
tmp.write (buff [i])
i = i + 1
- while (i < nLines) and (string.find (buff [i], "};") < 0):
+ while (i < nLines) and (buff[i].find("};") < 0):
tmp.write (buff [i])
i = i + 1
@@ -293,7 +293,7 @@ def varhier (filelist):
if not flag:
tmp.write (buff [i])
- if flag and not ((string.find (buff [i], "};") >= 0) or (string.find (buff [i], "NULL") >= 0)):
+ if flag and not ((buff[i].find("};") >= 0) or (buff[i].find("NULL") >= 0)):
flag = FALSE
i = i + 1
@@ -312,7 +312,7 @@ def appQuit (filelist):
for fn in filelist:
m = open (opPath + fn, 'r')
tmpname = os.path.splitext (fn) [0] + '.tmp'
- tmp = StringIO.StringIO ()
+ tmp = io.StringIO ()
buff = m.readlines ()
m.close ()
@@ -320,20 +320,20 @@ def appQuit (filelist):
i = 0
nLines = len (buff)
- while (i < nLines) and (string.find (buff [i], 'import libsip') < 0):
+ while (i < nLines) and (buff[i].find('import libsip') < 0):
tmp.write (buff [i])
i = i + 1
tmp.write (buff [i] + "\nfrom PyTQt.qt import TQCloseEvent")
i = i + 1
- while (i < nLines) and (string.find (buff [i], "class TDEApplication") < 0):
+ while (i < nLines) and (buff[i].find("class TDEApplication") < 0):
tmp.write (buff [i])
i = i + 1
count = 0
while count < 2:
- while (i < nLines) and (string.find (buff [i], "return") < 0):
+ while (i < nLines) and (buff[i].find("return") < 0):
tmp.write (buff [i])
i = i + 1
@@ -408,9 +408,9 @@ def fixSignal (filelist):
count = 0
for line in m:
if count < times:
- if string.find (line, "proxySlot(unsigned long)") > 0\
- or string.find (line, "proxySlot(unsigned long a0)") > 0:
- line = string.replace (line, "unsigned long", "WId")
+ if line.find("proxySlot(unsigned long)") > 0\
+ or line.find("proxySlot(unsigned long a0)") > 0:
+ line = line.replace("unsigned long", "WId")
count = count + 1
n.write (line)
@@ -439,13 +439,13 @@ def kjsfix (filelist):
purevirt = ["toPrimitive", "toBoolean", "toNumber", "toString", "toObject"]
while (i < nLines):
- if string.find (buff [i], "KJS::ExecState") >= 0:
+ if buff[i].find("KJS::ExecState") >= 0:
for pv in purevirt:
- if string.find (buff [i], pv) >= 0:
+ if buff[i].find(pv) >= 0:
i = i + 2
buff [i] = "\t\treturn KJS::ObjectImp::%s(a0);" % pv
i = i + 1
- while string.find (buff [i], "}") < 0:
+ while buff[i].find("}") < 0:
buff [i] = ""
i = i + 1
break
@@ -474,37 +474,37 @@ if operation != "shpix":
if operation == "tr":
if not trFix (filelist):
- print 'operation error -- tr'
+ print('operation error -- tr')
sys.exit (-1)
elif operation == 'qtNoTr':
if not qtNoTr (filelist):
- print 'operation error -- qtNoTr'
+ print('operation error -- qtNoTr')
sys.exit (-1)
elif operation == 'shpix':
if not shpix ():
- print 'operation error -- shpix'
+ print('operation error -- shpix')
sys.exit (-1)
elif operation == "notify":
if not notify ():
- print "operation error -- notify"
+ print("operation error -- notify")
sys.exit (-1)
elif operation == "varhier":
if not varhier (filelist):
- print "operation error -- varhier"
+ print("operation error -- varhier")
sys.exit (-1)
elif operation == "appQuit":
if not appQuit (filelist):
- print "operation error -- appQuit"
+ print("operation error -- appQuit")
sys.exit (-1)
elif operation == "kjsfix":
if not kjsfix (filelist):
- print "operation error -- kjsfix"
+ print("operation error -- kjsfix")
sys.exit (-1)
elif operation == "fixTQVariant":
@@ -514,7 +514,7 @@ elif operation == "fixTQVariant":
elif operation == "fixSignal":
if not fixSignal (filelist):
- print "operation error -- fixSignal"
+ print("operation error -- fixSignal")
sys.exit (-1)
sys.exit (0)