py3: src/Tools: python3 diff, 1. part

issue 0000995
This commit is contained in:
looooo
2017-05-30 16:13:55 +02:00
committed by wmayer
parent 70a9cce767
commit cf62d45931
7 changed files with 104 additions and 69 deletions

View File

@@ -7,6 +7,8 @@
# WARNING! All changes made in this file will be lost!
#
from __future__ import print_function # this allows py2 to print(str1,str2) correctly
import sys
import getopt
from xml.dom import minidom
@@ -1808,7 +1810,7 @@ class SaxGeneratemodelHandler(handler.ContentHandler):
self.locator = locator
def showError(self, msg):
print '*** (showError):', msg
print('*** (showError):', msg)
sys.exit(-1)
def startElement(self, name, attrs):
@@ -2266,7 +2268,7 @@ Options:
"""
def usage():
print USAGE_TEXT
print(USAGE_TEXT)
sys.exit(-1)
@@ -2295,10 +2297,10 @@ def parseSelect(inFileName):
except StopIteration:
topElementName = documentHandler.getTopElementName()
if topElementName is None:
raise RuntimeError, 'no top level element'
raise RuntimeError('no top level element')
topElementName = topElementName.replace('-', '_').replace(':', '_')
if topElementName not in globals():
raise RuntimeError, 'no class for top element: %s' % topElementName
raise RuntimeError('no class for top element: %s' % topElementName)
topElement = globals()[topElementName]
infile.seek(0)
doc = minidom.parse(infile)