Migrate python2 code to python3:
Updated all required lines which contains 'print' Updated all required lines which contains 'except'
This commit is contained in:
parent
d41e328253
commit
41e57a7512
|
@ -11,8 +11,8 @@ if __name__ == "__main__":
|
|||
|
||||
try:
|
||||
scriptPath = os.path.abspath( os.path.dirname(sys.argv[0]) )
|
||||
print 'buildCoriolis.py is run from:'
|
||||
print ' <%s>' % scriptPath
|
||||
print('buildCoriolis.py is run from:')
|
||||
print(' <%s>' % scriptPath)
|
||||
|
||||
parser = optparse.OptionParser ()
|
||||
# Build relateds.
|
||||
|
@ -80,11 +80,11 @@ if __name__ == "__main__":
|
|||
elif options.doRpm: builder.doRpm ()
|
||||
elif options.doDeb: builder.doDeb ()
|
||||
else: builder.build ( tools=options.tools, projects=options.projects )
|
||||
except ErrorMessage, e:
|
||||
print e
|
||||
except ErrorMessage as e:
|
||||
print(e)
|
||||
sys.exit(e.code)
|
||||
#except Exception, e:
|
||||
# print e
|
||||
#except Exception as e:
|
||||
# print(e)
|
||||
# sys.exit(1)
|
||||
|
||||
sys.exit ( 0 )
|
||||
|
|
|
@ -39,7 +39,7 @@ try:
|
|||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.application import MIMEApplication
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
module = str(e).split()[-1]
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ErrorMessage ( Exception ):
|
|||
return
|
||||
|
||||
def terminate ( self ):
|
||||
print self
|
||||
print(self)
|
||||
sys.exit(self._code)
|
||||
|
||||
@property
|
||||
|
@ -122,7 +122,7 @@ class Command ( object ):
|
|||
self.fdLog = fdLog
|
||||
|
||||
if self.fdLog != None and not isinstance(self.fdLog,file):
|
||||
print '[WARNING] Command.__init__(): <fdLog> is neither None or a file.'
|
||||
print('[WARNING] Command.__init__(): <fdLog> is neither None or a file.')
|
||||
return
|
||||
|
||||
def _argumentsToStr ( self, arguments ):
|
||||
|
@ -133,7 +133,7 @@ class Command ( object ):
|
|||
return s
|
||||
|
||||
def log ( self, text ):
|
||||
print text[:-1]
|
||||
print(text[:-1])
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
if isinstance(self.fdLog,file):
|
||||
|
@ -151,12 +151,12 @@ class Command ( object ):
|
|||
if homeDir.startswith(homeDir):
|
||||
workDir = '~' + workDir[ len(homeDir) : ]
|
||||
user = 'root'
|
||||
if os.environ.has_key('USER'): user = os.environ['USER']
|
||||
if 'USER' in os.environ: user = os.environ['USER']
|
||||
prompt = '%s@%s:%s$' % (user,conf.masterHost,workDir)
|
||||
|
||||
try:
|
||||
self.log( '%s%s\n' % (prompt,self._argumentsToStr(self.arguments)) )
|
||||
print self.arguments
|
||||
print(self.arguments)
|
||||
child = subprocess.Popen( self.arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
|
||||
|
||||
while True:
|
||||
|
@ -164,7 +164,7 @@ class Command ( object ):
|
|||
if not line: break
|
||||
|
||||
self.log( line )
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
raise BadBinary( self.arguments[0] )
|
||||
|
||||
(pid,status) = os.waitpid( child.pid, 0 )
|
||||
|
@ -258,12 +258,12 @@ class GitRepository ( object ):
|
|||
|
||||
def removeLocalRepo ( self ):
|
||||
if os.path.isdir(self.localRepoDir):
|
||||
print 'Removing Git local repository: <%s>' % self.localRepoDir
|
||||
print('Removing Git local repository: <%s>' % self.localRepoDir)
|
||||
shutil.rmtree( self.localRepoDir )
|
||||
return
|
||||
|
||||
def clone ( self ):
|
||||
print 'Clone/pull from:', self.url
|
||||
print('Clone/pull from:', self.url)
|
||||
if not os.path.isdir(self.cloneDir):
|
||||
os.makedirs( self.cloneDir )
|
||||
|
||||
|
@ -329,12 +329,12 @@ class Configuration ( object ):
|
|||
|
||||
def __setattr__ ( self, attribute, value ):
|
||||
if attribute in Configuration.SecondaryNames:
|
||||
print ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute )
|
||||
print(ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute ))
|
||||
return
|
||||
|
||||
if attribute == 'masterHost' or attribute == '_masterHost':
|
||||
if value == 'lepka':
|
||||
print 'Never touch the Git tree when running on <lepka>.'
|
||||
print('Never touch the Git tree when running on <lepka>.')
|
||||
self._rmSource = False
|
||||
self._rmBuild = False
|
||||
self._doGit = False
|
||||
|
@ -393,7 +393,7 @@ class Configuration ( object ):
|
|||
while True:
|
||||
logFile = os.path.join(self._logDir,"%s-%s-%02d.log" % (stem,timeTag,index))
|
||||
if not os.path.isfile(logFile):
|
||||
print "Report log: <%s>" % logFile
|
||||
print("Report log: <%s>" % logFile)
|
||||
break
|
||||
index += 1
|
||||
fd = open( logFile, "w" )
|
||||
|
@ -506,7 +506,7 @@ class Report ( object ):
|
|||
fd = open( logFile, 'rb' )
|
||||
try:
|
||||
fd.seek( -1024*100, os.SEEK_END )
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
pass
|
||||
tailLines = ''
|
||||
for line in fd.readlines()[1:]:
|
||||
|
@ -525,8 +525,8 @@ class Report ( object ):
|
|||
for attachement in self.attachements:
|
||||
self.message.attach( attachement )
|
||||
|
||||
print "Sending mail report to:"
|
||||
for receiver in self.conf.receivers: print ' <%s>' % receiver
|
||||
print("Sending mail report to:")
|
||||
for receiver in self.conf.receivers: print(' <%s>' % receiver)
|
||||
session = smtplib.SMTP( 'localhost' )
|
||||
session.sendmail( self.conf.sender, self.conf.receivers, self.message.as_string() )
|
||||
session.quit()
|
||||
|
@ -613,29 +613,29 @@ try:
|
|||
for entry in os.listdir(conf.rootDir):
|
||||
if entry.startswith('Linux.'):
|
||||
buildDir = conf.rootDir+'/'+entry
|
||||
print 'Removing OS build directory: <%s>' % buildDir
|
||||
print('Removing OS build directory: <%s>' % buildDir)
|
||||
shutil.rmtree( buildDir )
|
||||
|
||||
commands = conf.getCommands( options.profile )
|
||||
for command in commands:
|
||||
if command.host:
|
||||
print 'Executing command on remote host <%s>:' % host
|
||||
print('Executing command on remote host <%s>:' % host)
|
||||
else:
|
||||
print 'Executing command on *local* host:'
|
||||
print ' %s' % str(command)
|
||||
print('Executing command on *local* host:')
|
||||
print(' %s' % str(command))
|
||||
command.execute()
|
||||
|
||||
conf.closeLogs()
|
||||
|
||||
conf.success = True
|
||||
|
||||
except ErrorMessage, e:
|
||||
print e
|
||||
except ErrorMessage as e:
|
||||
print(e)
|
||||
conf.closeLogs()
|
||||
conf.success = False
|
||||
|
||||
if showTrace:
|
||||
print '\nPython stack trace:'
|
||||
print('\nPython stack trace:')
|
||||
traceback.print_tb( sys.exc_info()[2] )
|
||||
conf.rcode = e.code
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ try:
|
|||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.application import MIMEApplication
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
module = str(e).split()[-1]
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ErrorMessage ( Exception ):
|
|||
return
|
||||
|
||||
def terminate ( self ):
|
||||
print self
|
||||
print(self)
|
||||
sys.exit(self._code)
|
||||
|
||||
@property
|
||||
|
@ -122,7 +122,7 @@ class Command ( object ):
|
|||
self.fdLog = fdLog
|
||||
|
||||
if self.fdLog != None and not isinstance(self.fdLog,file):
|
||||
print '[WARNING] Command.__init__(): <fdLog> is neither None or a file.'
|
||||
print('[WARNING] Command.__init__(): <fdLog> is neither None or a file.')
|
||||
return
|
||||
|
||||
def _argumentsToStr ( self, arguments ):
|
||||
|
@ -133,7 +133,7 @@ class Command ( object ):
|
|||
return s
|
||||
|
||||
def log ( self, text ):
|
||||
print text[:-1]
|
||||
print(text[:-1])
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
if isinstance(self.fdLog,file):
|
||||
|
@ -151,12 +151,12 @@ class Command ( object ):
|
|||
if homeDir.startswith(homeDir):
|
||||
workDir = '~' + workDir[ len(homeDir) : ]
|
||||
user = 'root'
|
||||
if os.environ.has_key('USER'): user = os.environ['USER']
|
||||
if 'USER' in os.environ: user = os.environ['USER']
|
||||
prompt = '%s@%s:%s$' % (user,conf.masterHost,workDir)
|
||||
|
||||
try:
|
||||
self.log( '%s%s\n' % (prompt,self._argumentsToStr(self.arguments)) )
|
||||
print self.arguments
|
||||
print(self.arguments)
|
||||
child = subprocess.Popen( self.arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
|
||||
|
||||
while True:
|
||||
|
@ -164,7 +164,7 @@ class Command ( object ):
|
|||
if not line: break
|
||||
|
||||
self.log( line )
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
raise BadBinary( self.arguments[0] )
|
||||
|
||||
(pid,status) = os.waitpid( child.pid, 0 )
|
||||
|
@ -251,12 +251,12 @@ class GitRepository ( object ):
|
|||
|
||||
def removeLocalRepo ( self ):
|
||||
if os.path.isdir(self.localRepoDir):
|
||||
print 'Removing Git local repository: <%s>' % self.localRepoDir
|
||||
print('Removing Git local repository: <%s>' % self.localRepoDir)
|
||||
shutil.rmtree( self.localRepoDir )
|
||||
return
|
||||
|
||||
def clone ( self ):
|
||||
print 'Clone/pull from:', self.url
|
||||
print('Clone/pull from:', self.url)
|
||||
if not os.path.isdir(self.cloneDir):
|
||||
os.makedirs( self.cloneDir )
|
||||
|
||||
|
@ -321,12 +321,12 @@ class Configuration ( object ):
|
|||
|
||||
def __setattr__ ( self, attribute, value ):
|
||||
if attribute in Configuration.SecondaryNames:
|
||||
print ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute )
|
||||
print(ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute ))
|
||||
return
|
||||
|
||||
if attribute == 'masterHost' or attribute == '_masterHost':
|
||||
if value == 'lepka':
|
||||
print 'Never touch the Git tree when running on <lepka>.'
|
||||
print('Never touch the Git tree when running on <lepka>.')
|
||||
self._rmSource = False
|
||||
self._rmBuild = False
|
||||
self._doGit = False
|
||||
|
@ -384,7 +384,7 @@ class Configuration ( object ):
|
|||
while True:
|
||||
logFile = os.path.join(self._logDir,"%s-%s-%02d.log" % (stem,timeTag,index))
|
||||
if not os.path.isfile(logFile):
|
||||
print "Report log: <%s>" % logFile
|
||||
print("Report log: <%s>" % logFile)
|
||||
break
|
||||
index += 1
|
||||
fd = open( logFile, "w" )
|
||||
|
@ -490,7 +490,7 @@ class Report ( object ):
|
|||
fd = open( logFile, 'rb' )
|
||||
try:
|
||||
fd.seek( -1024*100, os.SEEK_END )
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
pass
|
||||
tailLines = ''
|
||||
for line in fd.readlines()[1:]:
|
||||
|
@ -509,8 +509,8 @@ class Report ( object ):
|
|||
for attachement in self.attachements:
|
||||
self.message.attach( attachement )
|
||||
|
||||
print "Sending mail report to:"
|
||||
for receiver in self.conf.receivers: print ' <%s>' % receiver
|
||||
print("Sending mail report to:")
|
||||
for receiver in self.conf.receivers: print(' <%s>' % receiver)
|
||||
session = smtplib.SMTP( 'localhost' )
|
||||
session.sendmail( self.conf.sender, self.conf.receivers, self.message.as_string() )
|
||||
session.quit()
|
||||
|
@ -594,29 +594,29 @@ try:
|
|||
for entry in os.listdir(conf.rootDir):
|
||||
if entry.startswith('Linux.'):
|
||||
buildDir = conf.rootDir+'/'+entry
|
||||
print 'Removing OS build directory: <%s>' % buildDir
|
||||
print('Removing OS build directory: <%s>' % buildDir)
|
||||
shutil.rmtree( buildDir )
|
||||
|
||||
commands = conf.getCommands( options.profile )
|
||||
for command in commands:
|
||||
if command.host:
|
||||
print 'Executing command on remote host <%s>:' % host
|
||||
print('Executing command on remote host <%s>:' % host)
|
||||
else:
|
||||
print 'Executing command on *local* host:'
|
||||
print ' %s' % str(command)
|
||||
print('Executing command on *local* host:')
|
||||
print(' %s' % str(command))
|
||||
command.execute()
|
||||
|
||||
conf.closeLogs()
|
||||
|
||||
conf.success = True
|
||||
|
||||
except ErrorMessage, e:
|
||||
print e
|
||||
except ErrorMessage as e:
|
||||
print(e)
|
||||
conf.closeLogs()
|
||||
conf.success = False
|
||||
|
||||
if showTrace:
|
||||
print '\nPython stack trace:'
|
||||
print('\nPython stack trace:')
|
||||
traceback.print_tb( sys.exc_info()[2] )
|
||||
conf.rcode = e.code
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ try:
|
|||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.application import MIMEApplication
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
module = str(e).split()[-1]
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ErrorMessage ( Exception ):
|
|||
return
|
||||
|
||||
def terminate ( self ):
|
||||
print self
|
||||
print(self)
|
||||
sys.exit(self._code)
|
||||
|
||||
@property
|
||||
|
@ -122,7 +122,7 @@ class Command ( object ):
|
|||
self.fdLog = fdLog
|
||||
|
||||
if self.fdLog != None and not isinstance(self.fdLog,file):
|
||||
print '[WARNING] Command.__init__(): <fdLog> is neither None or a file.'
|
||||
print('[WARNING] Command.__init__(): <fdLog> is neither None or a file.')
|
||||
return
|
||||
|
||||
def _argumentsToStr ( self, arguments ):
|
||||
|
@ -133,7 +133,7 @@ class Command ( object ):
|
|||
return s
|
||||
|
||||
def log ( self, text ):
|
||||
print text[:-1]
|
||||
print(text[:-1])
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
if isinstance(self.fdLog,file):
|
||||
|
@ -151,12 +151,12 @@ class Command ( object ):
|
|||
if homeDir.startswith(homeDir):
|
||||
workDir = '~' + workDir[ len(homeDir) : ]
|
||||
user = 'root'
|
||||
if os.environ.has_key('USER'): user = os.environ['USER']
|
||||
if 'USER' in os.environ: user = os.environ['USER']
|
||||
prompt = '%s@%s:%s$' % (user,conf.masterHost,workDir)
|
||||
|
||||
try:
|
||||
self.log( '%s%s\n' % (prompt,self._argumentsToStr(self.arguments)) )
|
||||
print self.arguments
|
||||
print(self.arguments)
|
||||
child = subprocess.Popen( self.arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
|
||||
|
||||
while True:
|
||||
|
@ -164,7 +164,7 @@ class Command ( object ):
|
|||
if not line: break
|
||||
|
||||
self.log( line )
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
raise BadBinary( self.arguments[0] )
|
||||
|
||||
(pid,status) = os.waitpid( child.pid, 0 )
|
||||
|
@ -258,12 +258,12 @@ class GitRepository ( object ):
|
|||
|
||||
def removeLocalRepo ( self ):
|
||||
if os.path.isdir(self.localRepoDir):
|
||||
print 'Removing Git local repository: <%s>' % self.localRepoDir
|
||||
print('Removing Git local repository: <%s>' % self.localRepoDir)
|
||||
shutil.rmtree( self.localRepoDir )
|
||||
return
|
||||
|
||||
def clone ( self ):
|
||||
print 'Clone/pull from:', self.url
|
||||
print('Clone/pull from:', self.url)
|
||||
if not os.path.isdir(self.cloneDir):
|
||||
os.makedirs( self.cloneDir )
|
||||
|
||||
|
@ -329,12 +329,12 @@ class Configuration ( object ):
|
|||
|
||||
def __setattr__ ( self, attribute, value ):
|
||||
if attribute in Configuration.SecondaryNames:
|
||||
print ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute )
|
||||
print(ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute ))
|
||||
return
|
||||
|
||||
if attribute == 'masterHost' or attribute == '_masterHost':
|
||||
if value == 'lepka':
|
||||
print 'Never touch the Git tree when running on <lepka>.'
|
||||
print('Never touch the Git tree when running on <lepka>.')
|
||||
self._rmSource = False
|
||||
self._rmBuild = False
|
||||
self._doGit = False
|
||||
|
@ -393,7 +393,7 @@ class Configuration ( object ):
|
|||
while True:
|
||||
logFile = os.path.join(self._logDir,"%s-%s-%02d.log" % (stem,timeTag,index))
|
||||
if not os.path.isfile(logFile):
|
||||
print "Report log: <%s>" % logFile
|
||||
print("Report log: <%s>" % logFile)
|
||||
break
|
||||
index += 1
|
||||
fd = open( logFile, "w" )
|
||||
|
@ -506,7 +506,7 @@ class Report ( object ):
|
|||
fd = open( logFile, 'rb' )
|
||||
try:
|
||||
fd.seek( -1024*100, os.SEEK_END )
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
pass
|
||||
tailLines = ''
|
||||
for line in fd.readlines()[1:]:
|
||||
|
@ -525,8 +525,8 @@ class Report ( object ):
|
|||
for attachement in self.attachements:
|
||||
self.message.attach( attachement )
|
||||
|
||||
print "Sending mail report to:"
|
||||
for receiver in self.conf.receivers: print ' <%s>' % receiver
|
||||
print("Sending mail report to:")
|
||||
for receiver in self.conf.receivers: print(' <%s>' % receiver)
|
||||
session = smtplib.SMTP( 'localhost' )
|
||||
session.sendmail( self.conf.sender, self.conf.receivers, self.message.as_string() )
|
||||
session.quit()
|
||||
|
@ -613,29 +613,29 @@ try:
|
|||
for entry in os.listdir(conf.rootDir):
|
||||
if entry.startswith('Linux.'):
|
||||
buildDir = conf.rootDir+'/'+entry
|
||||
print 'Removing OS build directory: <%s>' % buildDir
|
||||
print('Removing OS build directory: <%s>' % buildDir)
|
||||
shutil.rmtree( buildDir )
|
||||
|
||||
commands = conf.getCommands( options.profile )
|
||||
for command in commands:
|
||||
if command.host:
|
||||
print 'Executing command on remote host <%s>:' % host
|
||||
print('Executing command on remote host <%s>:' % host)
|
||||
else:
|
||||
print 'Executing command on *local* host:'
|
||||
print ' %s' % str(command)
|
||||
print('Executing command on *local* host:')
|
||||
print(' %s' % str(command))
|
||||
command.execute()
|
||||
|
||||
conf.closeLogs()
|
||||
|
||||
conf.success = True
|
||||
|
||||
except ErrorMessage, e:
|
||||
print e
|
||||
except ErrorMessage as e:
|
||||
print(e)
|
||||
conf.closeLogs()
|
||||
conf.success = False
|
||||
|
||||
if showTrace:
|
||||
print '\nPython stack trace:'
|
||||
print('\nPython stack trace:')
|
||||
traceback.print_tb( sys.exc_info()[2] )
|
||||
conf.rcode = e.code
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ def guessOs ():
|
|||
uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE )
|
||||
osType = uname.stdout.readlines()[0][:-1]
|
||||
|
||||
#print "[WARNING] Unrecognized OS: \"%s\"." % lines[0][:-1]
|
||||
#print " (using: \"%s\")" % osType
|
||||
#print("[WARNING] Unrecognized OS: \"%s\"." % lines[0][:-1])
|
||||
#print(" (using: \"%s\")" % osType)
|
||||
|
||||
return (osType,libDir)
|
||||
|
||||
|
@ -118,10 +118,10 @@ export PATH LD_LIBRARY_PATH PYTHONPATH BOOTSTRAP_TOP CORIOLIS_TOP MANGROVE_TOP;
|
|||
hash -r
|
||||
"""
|
||||
|
||||
print shellScript % { "PATH" : strippedPath
|
||||
print(shellScript % { "PATH" : strippedPath
|
||||
, "LD_LIBRARY_PATH" : strippedLibraryPath
|
||||
, "PYTHONPATH" : strippedPythonPath
|
||||
, "CORIOLIS_TOP" : sysCoriolisTop
|
||||
, "MANGROVE_TOP" : mangroveTop
|
||||
, "buildDir" : buildDir
|
||||
}
|
||||
})
|
||||
|
|
|
@ -57,7 +57,7 @@ class Refactor:
|
|||
|
||||
m = refactorPattern.match( line )
|
||||
if m:
|
||||
print "o:\"%s\" r:\"%s\"" % ( m.group("orig"), m.group("replace") )
|
||||
print("o:\"%s\" r:\"%s\"" % ( m.group("orig"), m.group("replace") ))
|
||||
self._addRefactor( m.group("orig"), m.group("replace") )
|
||||
fd.close ()
|
||||
return
|
||||
|
@ -92,7 +92,7 @@ if __name__ == '__main__' :
|
|||
allFiles += rfiles
|
||||
|
||||
for file in allFiles:
|
||||
print file
|
||||
print(file)
|
||||
refactor.doFileRefactor( file )
|
||||
|
||||
sys.exit( 0 )
|
||||
|
|
|
@ -12,7 +12,7 @@ soPathName = sys.argv[1]
|
|||
soFileName = os.path.basename( soPathName )
|
||||
profName = soFileName + '.profile'
|
||||
if not os.path.isfile(profName):
|
||||
print '[ERROR] No profile datas <%s>.' % profName
|
||||
print('[ERROR] No profile datas <%s>.' % profName)
|
||||
sys.exit( 1 )
|
||||
|
||||
sprof = subprocess.Popen ( ['sprof'
|
||||
|
@ -30,8 +30,8 @@ for line in sprof.stdout.readlines():
|
|||
, stdout=subprocess.PIPE )
|
||||
symbol = cppfilt.stdout.readlines()[0][:-1]
|
||||
|
||||
print m.group('head'), symbol
|
||||
print(m.group('head'), symbol)
|
||||
else:
|
||||
print line[:-1]
|
||||
print(line[:-1])
|
||||
|
||||
sys.exit( 0 )
|
||||
|
|
|
@ -16,7 +16,7 @@ try:
|
|||
import Viewer
|
||||
import CRL
|
||||
import plugins.rsave
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
catch( e )
|
||||
sys.exit(2)
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ try:
|
|||
import helpers
|
||||
from helpers import trace
|
||||
from helpers.io import ErrorMessage
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
serror = str(e)
|
||||
if serror.startswith('No module named'):
|
||||
module = serror.split()[-1]
|
||||
|
@ -46,7 +46,7 @@ except ImportError, e:
|
|||
print( ' Under RHEL 6, you must be under devtoolset-2.' )
|
||||
print( ' (scl enable devtoolset-2 bash)' )
|
||||
sys.exit(1)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print( '[ERROR] A strange exception occurred while loading the basic Coriolis/Python' )
|
||||
print( ' modules. Something may be wrong at Python/C API level.\n' )
|
||||
print( ' {}'.format(e) )
|
||||
|
@ -120,7 +120,7 @@ def px2mpx ( editor, pxCell ):
|
|||
if pxCell == None:
|
||||
raise ErrorMessage( 3, 'px2mpx.px2mpx(): Mandatory pxCell argument is None.' )
|
||||
mpxCell = None
|
||||
print '\nProcessing', pxCell
|
||||
print('\nProcessing', pxCell)
|
||||
|
||||
UpdateSession.open()
|
||||
try:
|
||||
|
@ -163,7 +163,7 @@ def px2mpx ( editor, pxCell ):
|
|||
layer = component.getLayer()
|
||||
dupComponent = None
|
||||
|
||||
print ' Processing', component
|
||||
print(' Processing', component)
|
||||
|
||||
if isinstance(component,Contact):
|
||||
dupComponent = Contact.create( mpxNet
|
||||
|
@ -183,21 +183,21 @@ def px2mpx ( editor, pxCell ):
|
|||
if component.getSourceX() > component.getTargetX(): component.invert()
|
||||
if isinstance(layer,RegularLayer):
|
||||
if layer.getBasicLayer().getMaterial().getCode() == BasicLayer.Material.blockage:
|
||||
print ' Blockage BB:%s vs. AB:%s' % (bb, ab)
|
||||
print(' Blockage BB:%s vs. AB:%s' % (bb, ab))
|
||||
if layer.getName()[-1] == '2' or layer.getName()[-1] == '4':
|
||||
state = 0
|
||||
if bb.getXMin() <= ab.getXMin(): state |= Left
|
||||
if bb.getXMax() >= ab.getXMax(): state |= Right
|
||||
|
||||
if not (state&Left):
|
||||
print ' Shrink left.'
|
||||
print(' Shrink left.')
|
||||
dLLeft = dL - DbU.fromLambda( 1.5 )
|
||||
if not(state&Right):
|
||||
print ' Shrink right.'
|
||||
print(' Shrink right.')
|
||||
dLRight = dL - DbU.fromLambda( 1.5 )
|
||||
|
||||
if layer.getName()[-1] == '4' and state == AllSpan:
|
||||
print ' Skipping component.'
|
||||
print(' Skipping component.')
|
||||
skipComponent = True
|
||||
|
||||
width = mW
|
||||
|
@ -213,9 +213,9 @@ def px2mpx ( editor, pxCell ):
|
|||
, component.getDxSource()*2 - dLLeft
|
||||
, component.getDxTarget()*2 + dLRight
|
||||
)
|
||||
print ' Copy:', dupComponent
|
||||
print(' Copy:', dupComponent)
|
||||
else:
|
||||
print ' Horizontal component too small *or* skipped, not converted'
|
||||
print(' Horizontal component too small *or* skipped, not converted')
|
||||
|
||||
elif isinstance(component,Vertical):
|
||||
dL, dW, mW = getDeltas( component.getLayer() )
|
||||
|
@ -245,7 +245,7 @@ def px2mpx ( editor, pxCell ):
|
|||
|
||||
if layer.getName()[-1] == '5':
|
||||
if state == AllSpan:
|
||||
print ' Skipping component.'
|
||||
print(' Skipping component.')
|
||||
skipComponent = True
|
||||
else:
|
||||
dLTop = DbU.fromLambda(120.0) - component.getDyTarget()*2
|
||||
|
@ -263,20 +263,20 @@ def px2mpx ( editor, pxCell ):
|
|||
, component.getDyTarget()*2 + dLTop
|
||||
)
|
||||
else:
|
||||
print ' Vertical component too small *or* skipped, not converted'
|
||||
print(' Vertical component too small *or* skipped, not converted')
|
||||
|
||||
else:
|
||||
print '[WARNING] Unchanged component:', component
|
||||
print('[WARNING] Unchanged component:', component)
|
||||
|
||||
if dupComponent and NetExternalComponents.isExternal( component ):
|
||||
NetExternalComponents.setExternal( dupComponent )
|
||||
|
||||
if editor: editor.fit()
|
||||
|
||||
except ErrorMessage, e:
|
||||
print e; errorCode = e.code
|
||||
except Exception, e:
|
||||
print '\n\n', e; errorCode = 1
|
||||
except ErrorMessage as e:
|
||||
print(e); errorCode = e.code
|
||||
except Exception as e:
|
||||
print('\n\n', e); errorCode = 1
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
|
||||
UpdateSession.close()
|
||||
|
@ -297,7 +297,7 @@ def scriptMain ( **kw ):
|
|||
editor = None
|
||||
if kw.has_key('editor') and kw['editor']:
|
||||
editor = kw['editor']
|
||||
print ' o Editor detected, running in graphic mode.'
|
||||
print(' o Editor detected, running in graphic mode.')
|
||||
if pxCell == None: pxCell = editor.getCell()
|
||||
|
||||
if pxCell:
|
||||
|
@ -306,7 +306,7 @@ def scriptMain ( **kw ):
|
|||
pxlibDir = '/dsk/l1/jpc/alliance/Linux.slsoc6x/install/cells/pxlib'
|
||||
|
||||
if os.path.isdir(pxlibDir):
|
||||
print ' o <%s> found.' % pxlibDir
|
||||
print(' o <%s> found.' % pxlibDir)
|
||||
for viewFile in os.listdir( pxlibDir ):
|
||||
if viewFile == 'padreal.ap':
|
||||
pxCell = framework.getCell( viewFile[:-3], CRL.Catalog.State.Views )
|
||||
|
@ -323,7 +323,7 @@ def scriptMain ( **kw ):
|
|||
mpxCell = px2mpx( editor, pxCell )
|
||||
framework.saveCell( mpxCell, CRL.Catalog.State.Physical )
|
||||
else:
|
||||
print '[WARNING] <%s> not found.' % pxlibDir
|
||||
print('[WARNING] <%s> not found.' % pxlibDir)
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ if __name__ == '__main__':
|
|||
|
||||
rcode = yosys.run( options.design, top=options.top )
|
||||
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
catch( e )
|
||||
sys.exit(2)
|
||||
|
||||
|
|
|
@ -209,10 +209,10 @@ class Environment ( object ):
|
|||
libPath, mode = libraryEntry
|
||||
self.mbkEnv['MBK_CATA_LIB'].add( libPath, mode )
|
||||
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
e = ErrorMessage( e )
|
||||
e.addMessage( 'In %s:<Alliance> at index %d.' % (allianceFile,entryNo) )
|
||||
print e
|
||||
print(e)
|
||||
|
||||
self.mbkEnv[ 'LD_LIBRARY_PATH' ] = self.mbkEnv[ 'ALLIANCE_TOP' ] + '/lib'
|
||||
return
|
||||
|
@ -226,7 +226,7 @@ class Environment ( object ):
|
|||
env = os.environ
|
||||
for key in self.mbkEnv.keys():
|
||||
if not self.mbkEnv[key]:
|
||||
print WarningMessage( 'Environment variable <%s> is not set.' % key )
|
||||
print(WarningMessage( 'Environment variable <%s> is not set.' % key ))
|
||||
continue
|
||||
env[ key ] = str(self.mbkEnv[ key ])
|
||||
return env
|
||||
|
@ -314,7 +314,7 @@ class ReportLog ( object ):
|
|||
while True:
|
||||
self._reportFile = "./%s-%s-%02d.log" % (self._reportBase,timeTag,index)
|
||||
if not os.path.isfile(self._reportFile):
|
||||
print "Report log: <%s>" % self._reportFile
|
||||
print("Report log: <%s>" % self._reportFile)
|
||||
break
|
||||
index += 1
|
||||
return
|
||||
|
@ -353,31 +353,31 @@ def staticInitialization ():
|
|||
symbol = 'allianceConfig'
|
||||
|
||||
if not os.path.isfile(confFile):
|
||||
print '[ERROR] Missing mandatory Coriolis2 system file:'
|
||||
print ' <%s>' % confFile
|
||||
print('[ERROR] Missing mandatory Coriolis2 system file:')
|
||||
print(' <%s>' % confFile)
|
||||
sys.exit( 1 )
|
||||
|
||||
try:
|
||||
print ' o Running configuration hook: Alliance.staticInitialization().'
|
||||
print ' - Loading \"%s\".' % helpers.truncPath(confFile)
|
||||
print(' o Running configuration hook: Alliance.staticInitialization().')
|
||||
print(' - Loading \"%s\".' % helpers.truncPath(confFile))
|
||||
exec( open(confFile).read() ) #, moduleGlobals )
|
||||
except Exception, e:
|
||||
print '[ERROR] An exception occured while loading the configuration file:'
|
||||
print ' <%s>\n' % (confFile)
|
||||
print ' You should check for simple python errors in this file.'
|
||||
print ' Error was:'
|
||||
print ' %s\n' % e
|
||||
except Exception as e:
|
||||
print('[ERROR] An exception occured while loading the configuration file:')
|
||||
print(' <%s>\n' % (confFile))
|
||||
print(' You should check for simple python errors in this file.')
|
||||
print(' Error was:')
|
||||
print(' %s\n' % e)
|
||||
sys.exit( 1 )
|
||||
|
||||
if moduleGlobals.has_key(symbol):
|
||||
env.load( moduleGlobals[symbol], confFile )
|
||||
del moduleGlobals[symbol]
|
||||
else:
|
||||
print '[ERROR] Mandatory symbol <%s> is missing in system configuration file:' % symbol
|
||||
print ' <%s>' % confFile
|
||||
print('[ERROR] Mandatory symbol <%s> is missing in system configuration file:' % symbol)
|
||||
print(' <%s>' % confFile)
|
||||
sys.exit( 1 )
|
||||
|
||||
print
|
||||
print()
|
||||
return
|
||||
|
||||
|
||||
|
@ -453,7 +453,7 @@ class Node ( EnvironmentWrapper ):
|
|||
if self._dependencies == []:
|
||||
raise ErrorMessage( 1, 'Node.setDefaultTargetName(): node is neither used nor have dependencies.' )
|
||||
self.setTarget( self.getDependency(0)._targetName+'_'+self.toolName.lower() )
|
||||
print WarningMessage( 'Node.setDefaultTargetName(): Node is not affected, using: <%s>' % self.targetName )
|
||||
print(WarningMessage( 'Node.setDefaultTargetName(): Node is not affected, using: <%s>' % self.targetName ))
|
||||
return
|
||||
|
||||
def addDependency ( self, dependency ):
|
||||
|
@ -492,21 +492,21 @@ class Node ( EnvironmentWrapper ):
|
|||
error = ErrorMessage( 1, 'File <%s> of node <%s> has not been created.'
|
||||
% (self.fileName,self._targetName) )
|
||||
if errorMessage:
|
||||
print
|
||||
for line in errorMessage: print line
|
||||
print()
|
||||
for line in errorMessage: print(line)
|
||||
if hardStop:
|
||||
raise error
|
||||
else:
|
||||
print error
|
||||
print(error)
|
||||
return
|
||||
|
||||
def isUptodate ( self ):
|
||||
depsMTime = 0
|
||||
#print ' Target: %-30s %d' % (self.fileName, self.mtime)
|
||||
#print(' Target: %-30s %d' % (self.fileName, self.mtime))
|
||||
for dependency in self.getDependencies():
|
||||
dependency.checkFile()
|
||||
depsMTime = max( depsMTime, dependency.mtime )
|
||||
#print ' | Dep: %-31s %d' % (dependency.fileName, dependency.mtime)
|
||||
#print(' | Dep: %-31s %d' % (dependency.fileName, dependency.mtime))
|
||||
return depsMTime <= self.mtime
|
||||
|
||||
def setActive ( self ):
|
||||
|
@ -522,7 +522,7 @@ class Node ( EnvironmentWrapper ):
|
|||
if not isinstance(self,Source) \
|
||||
and not isinstance(self,Probe) \
|
||||
and not isinstance(self,Rule):
|
||||
print 'Clean | %-30s| rm %s' % ( "<%s>"%self.ruleName, self.fileName )
|
||||
print('Clean | %-30s| rm %s' % ( "<%s>"%self.ruleName, self.fileName ))
|
||||
|
||||
report.open()
|
||||
report.write( 'Clean <%s>: (%s)\n' % (self.ruleName, self.fileName) )
|
||||
|
@ -622,7 +622,7 @@ class Command ( Node ):
|
|||
|
||||
if self.isActive() and (not self.isUptodate() or flags & ForceRun):
|
||||
if flags & ShowCommand:
|
||||
print "Executing | %-30s%s" % (ruleName,Command.indent(command,42))
|
||||
print("Executing | %-30s%s" % (ruleName,Command.indent(command,42)))
|
||||
child = subprocess.Popen( command
|
||||
, env=self.env.toSystemEnv()
|
||||
, stdout=subprocess.PIPE
|
||||
|
@ -639,7 +639,7 @@ class Command ( Node ):
|
|||
if not line: break
|
||||
|
||||
if flags & ShowLog:
|
||||
print "%s" % (line[:-1])
|
||||
print("%s" % (line[:-1]))
|
||||
sys.stdout.flush()
|
||||
elif flags & ShowDots:
|
||||
dots.dot()
|
||||
|
@ -661,8 +661,8 @@ class Command ( Node ):
|
|||
(pid,status) = os.waitpid(child.pid, 0)
|
||||
status >>= 8
|
||||
if status != 0:
|
||||
print
|
||||
for line in errorLines: print line
|
||||
print()
|
||||
for line in errorLines: print(line)
|
||||
raise ErrorMessage( 1, "%s returned status:%d." % (self.toolName,status) )
|
||||
if checkFile:
|
||||
self.checkFile( hardStop=True, errorMessage=errorLines )
|
||||
|
@ -670,7 +670,7 @@ class Command ( Node ):
|
|||
if self.isActive(): action = 'Up to date'
|
||||
else: action = 'Inactive'
|
||||
if flags & ShowCommand:
|
||||
print "%-10s| %-30s%s" % (action,ruleName,Command.indent(command,42))
|
||||
print("%-10s| %-30s%s" % (action,ruleName,Command.indent(command,42)))
|
||||
|
||||
report.open()
|
||||
report.write( '%s command:\n' % action )
|
||||
|
@ -1443,23 +1443,23 @@ class Tools ( object ):
|
|||
if node: node.setActive()
|
||||
|
||||
if commandFlags & ShowCommand and not (commandFlags & ShowLog):
|
||||
print "==========+===============================+============================================"
|
||||
print " ACTION | TARGET/RULE | COMMAND"
|
||||
print "==========+===============================+============================================"
|
||||
print("==========+===============================+============================================")
|
||||
print(" ACTION | TARGET/RULE | COMMAND")
|
||||
print("==========+===============================+============================================")
|
||||
|
||||
if doClean:
|
||||
Node.allClean()
|
||||
if commandFlags & ShowCommand and not (commandFlags & ShowLog):
|
||||
print "----------+-------------------------------+--------------------------------------------"
|
||||
print("----------+-------------------------------+--------------------------------------------")
|
||||
|
||||
for node in tool._staticOrder:
|
||||
#for dep in node.getDependencies():
|
||||
# print dep.name
|
||||
# print dep.fileName
|
||||
# print(dep.name)
|
||||
# print(dep.fileName)
|
||||
if not isinstance(node,Source) and not isinstance(node,Rule):
|
||||
if node._run(): break
|
||||
|
||||
if commandFlags & ShowCommand and not (commandFlags & ShowLog):
|
||||
print "----------+-------------------------------+--------------------------------------------"
|
||||
print("----------+-------------------------------+--------------------------------------------")
|
||||
|
||||
return
|
||||
|
|
|
@ -219,8 +219,8 @@ def pyAlimVerticalRail ( cell, xcoord ) :
|
|||
else :
|
||||
raise ErrorMessage(2,"AlimVerticalRail : Strawberry.")
|
||||
|
||||
# print "Placement of vertical rail"
|
||||
# print "Reference ", reference
|
||||
# print("Placement of vertical rail")
|
||||
# print("Reference ", reference)
|
||||
|
||||
power_cell = CRL.AllianceFramework.get().getCell ( "powmid_x0", CRL.Catalog.State.Views )
|
||||
|
||||
|
@ -1977,16 +1977,16 @@ def affichePad ( cell ) :
|
|||
global pad_north, pad_south, pad_east, pad_west
|
||||
|
||||
print( "Pads in the north are :" )
|
||||
for pad in pad_north : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
|
||||
for pad in pad_north : print(cell.getInstance ( pad.getName() ).getMasterCell().getName())
|
||||
|
||||
print( "Pads in the south are :" )
|
||||
for pad in pad_south : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
|
||||
for pad in pad_south : print(cell.getInstance ( pad.getName() ).getMasterCell().getName())
|
||||
|
||||
print( "Pads in the east are :" )
|
||||
for pad in pad_east : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
|
||||
for pad in pad_east : print(cell.getInstance ( pad.getName() ).getMasterCell().getName())
|
||||
|
||||
print( "Pads in the west are :" )
|
||||
for pad in pad_west : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
|
||||
for pad in pad_west : print(cell.getInstance ( pad.getName() ).getMasterCell().getName())
|
||||
|
||||
############
|
||||
def searchVddVss ( cell, *args ) :
|
||||
|
@ -2108,7 +2108,7 @@ def createGrid ( my_tuple ) :
|
|||
#_Xmax = None
|
||||
#_Ymax = None
|
||||
coreBox = cell.getInstance('core').getAbutmentBox()
|
||||
#print coreBox
|
||||
#print(coreBox)
|
||||
_Xmin = coreBox.getXMin()
|
||||
_Ymin = coreBox.getYMin()
|
||||
_Xmax = coreBox.getXMax()
|
||||
|
@ -2350,7 +2350,7 @@ def getNetInstances ( cell, net, transformation) :
|
|||
_x = ins_transformation.getX ( segment.getSourceX(), segment.getSourceY() )
|
||||
_y = ins_transformation.getY ( segment.getSourceX(), segment.getSourceY() )
|
||||
|
||||
#print ins, ":", segment, ",", nbSeg, ",", _x, ",", _y
|
||||
#print(ins, ":", segment, ",", nbSeg, ",", _x, ",", _y)
|
||||
nbSeg += 1
|
||||
ck_contact_list_to_create.append ( (_x, _y) )
|
||||
|
||||
|
@ -2363,9 +2363,9 @@ def getNetInstances ( cell, net, transformation) :
|
|||
Ymin = newbox.getYMin()
|
||||
Xmax = newbox.getXMax()
|
||||
Ymax = newbox.getYMax()
|
||||
#print " placer contact in ", _x, " ", _y , " in the net ", plug.getMasterNet().getName() ,
|
||||
#print " of instance ", plug.getInstance().getName() , " in ", Xmin , " ", Ymin ,
|
||||
#print " of model ", plug.getInstance().getMasterCell().getName(), "\n"
|
||||
#print(" placer contact in ", _x, " ", _y , " in the net ", plug.getMasterNet().getName())
|
||||
#print(" of instance ", plug.getInstance().getName() , " in ", Xmin , " ", Ymin)
|
||||
#print(" of model ", plug.getInstance().getMasterCell().getName(), "\n")
|
||||
|
||||
# Positionner la grille
|
||||
if ( Xmin < _Xmin ) or ( _Xmin == None ) : _Xmin = Xmin
|
||||
|
|
|
@ -333,8 +333,8 @@ class Side ( object ):
|
|||
# , height
|
||||
# ) )
|
||||
# if not connecteds:
|
||||
# print WarningMessage( 'Cannot find a suitable connector for <%s> on pad <%s>'
|
||||
# % (net.getName(),pad.getName()) )
|
||||
# print(WarningMessage( 'Cannot find a suitable connector for <%s> on pad <%s>'
|
||||
# % (net.getName(),pad.getName()) ))
|
||||
#
|
||||
# trace( 550, '-' )
|
||||
# return
|
||||
|
@ -348,7 +348,7 @@ class Side ( object ):
|
|||
# and masterCell.getName() != self._corona.pvddeckName \
|
||||
# and masterCell.getName() != self._corona.pvsseckName:
|
||||
# continue
|
||||
# #print 'Power pad:', pad
|
||||
# #print('Power pad:', pad)
|
||||
# self._createPowerContacts( pad, self._corona.vddi )
|
||||
# self._createPowerContacts( pad, self._corona.vssi )
|
||||
# if self._corona.useClockTree:
|
||||
|
@ -1281,7 +1281,7 @@ class Corona ( object ):
|
|||
# if not net:
|
||||
# net = self.cell.getNet( masterNet.getName() )
|
||||
# if not net:
|
||||
# print ErrorMessage( 1, 'Missing global net <%s> at chip level.' % masterNet.getName() )
|
||||
# print(ErrorMessage( 1, 'Missing global net <%s> at chip level.' % masterNet.getName() ))
|
||||
# continue
|
||||
#
|
||||
# for component in masterNet.getExternalComponents():
|
||||
|
@ -1297,17 +1297,17 @@ class Corona ( object ):
|
|||
# self._powerRails.sort( key=itemgetter(2) )
|
||||
#
|
||||
# #for rail in self._powerRails:
|
||||
# # print 'Pad rail %s @%d width:%d layer:%s' % ( str(rail[0].getName())
|
||||
# # print('Pad rail %s @%d width:%d layer:%s' % ( str(rail[0].getName())
|
||||
# # , DbU.toLambda(rail[2])
|
||||
# # , DbU.toLambda(rail[3])
|
||||
# # , str(rail[1].getName())
|
||||
# # )
|
||||
# # ))
|
||||
# return
|
||||
#
|
||||
# def _guessPadHvLayers ( self ):
|
||||
# if not self.powerPad:
|
||||
# print ErrorMessage( 1, 'There must be at least one pad of model "%s" to guess the pad power terminals.' \
|
||||
# % self.pvddick )
|
||||
# print(ErrorMessage( 1, 'There must be at least one pad of model "%s" to guess the pad power terminals.' \
|
||||
# % self.pvddick ))
|
||||
# return False
|
||||
#
|
||||
# availableDepths = set()
|
||||
|
@ -1316,7 +1316,7 @@ class Corona ( object ):
|
|||
# if component.getBoundingBox().getYMin() <= masterCell.getAbutmentBox().getYMin():
|
||||
# availableDepths.add( self.routingGauge.getLayerDepth(component.getLayer()) )
|
||||
#
|
||||
# #print 'available depth:', availableDepths
|
||||
# #print('available depth:', availableDepths)
|
||||
#
|
||||
# self._horizontalPadDepth = 0
|
||||
# self._verticalPadDepth = 0
|
||||
|
@ -1328,8 +1328,8 @@ class Corona ( object ):
|
|||
# if self.routingGauge.getLayerGauge(depth).getDirection() == RoutingLayerGauge.Vertical:
|
||||
# self._verticalPadDepth = depth
|
||||
#
|
||||
# #print 'h:', self._horizontalPadDepth
|
||||
# #print 'v:', self._verticalPadDepth
|
||||
# #print('h:', self._horizontalPadDepth)
|
||||
# #print('v:', self._verticalPadDepth)
|
||||
# return
|
||||
|
||||
|
||||
|
|
|
@ -587,9 +587,9 @@ def computeAbutmentBox ( cell, spaceMargin, aspectRatio, cellGauge ):
|
|||
# if math.trunc(columns) != columns: columns = math.trunc(columns) + 1
|
||||
# else: columns = math.trunc(columns)
|
||||
#
|
||||
# print ' o Creating abutment box (margin:%.1f%%, aspect ratio:%.1f%%, g-length:%.1fl)' \
|
||||
# % (spaceMargin*100.0,aspectRatio*100.0,(cellLength//sliceHeight))
|
||||
# print ' - GCell grid: [%dx%d]' % (columns,rows)
|
||||
# print(' o Creating abutment box (margin:%.1f%%, aspect ratio:%.1f%%, g-length:%.1fl)' \
|
||||
# % (spaceMargin*100.0,aspectRatio*100.0,(cellLength//sliceHeight)))
|
||||
# print(' - GCell grid: [%dx%d]' % (columns,rows))
|
||||
|
||||
UpdateSession.open()
|
||||
etesian = Etesian.EtesianEngine.create( cell )
|
||||
|
|
|
@ -3,20 +3,20 @@ from decimal import Decimal
|
|||
|
||||
techno = Techno.readFromFile("./example.dtr.xml")
|
||||
|
||||
print "+-----------------------------+"
|
||||
print "| technology: "+techno.get) + " |"
|
||||
print "| units: "+techno.getUnit() +" |"
|
||||
print "| version: "+techno.getVersion()+" |"
|
||||
print "+-----------------------------+\n\n"
|
||||
print("+-----------------------------+")
|
||||
print("| technology: "+techno.get) + " |")
|
||||
print("| units: "+techno.getUnit() +" |")
|
||||
print("| version: "+techno.getVersion()+" |")
|
||||
print("+-----------------------------+\n\n")
|
||||
|
||||
print "transistorMinL = %s"%techno.getValue("transistorMinL")
|
||||
print "transistorMinW = %s"%Decimal(techno.getValueAsString("transistorMinW"))
|
||||
print "minWidth of metal1 = %s"%techno.getValue("minWidth", "metal1")
|
||||
print "minSpacing of metal1 = %s"%techno.getValue("minWidth", "metal1")
|
||||
print "minSpacing of active vs poly = %s"%techno.getValue("minSpacing", "active", "poly")
|
||||
print "minExtension active over poly = %s"%techno.getValue("minExtension", "poly", "active")
|
||||
print "minArea of metal1 = %s"%techno.getValue("minArea", "metal1")
|
||||
print("transistorMinL = %s"%techno.getValue("transistorMinL"))
|
||||
print("transistorMinW = %s"%Decimal(techno.getValueAsString("transistorMinW")))
|
||||
print("minWidth of metal1 = %s"%techno.getValue("minWidth", "metal1"))
|
||||
print("minSpacing of metal1 = %s"%techno.getValue("minWidth", "metal1"))
|
||||
print("minSpacing of active vs poly = %s"%techno.getValue("minSpacing", "active", "poly"))
|
||||
print("minExtension active over poly = %s"%techno.getValue("minExtension", "poly", "active"))
|
||||
print("minArea of metal1 = %s"%techno.getValue("minArea", "metal1"))
|
||||
|
||||
# an example of why it is important to use Decimal in python:
|
||||
print techno.getValue("minArea", "metal1")*3-0.3 # returns 5.55111512313e-17
|
||||
print Decimal(techno.getValueAsString("minArea", "metal1"))*3-Decimal('0.3') # returns 0.000
|
||||
print(techno.getValue("minArea", "metal1")*3-0.3) # returns 5.55111512313e-17
|
||||
print(Decimal(techno.getValueAsString("minArea", "metal1"))*3-Decimal('0.3')) # returns 0.000
|
||||
|
|
|
@ -4,20 +4,20 @@ library = Library.readFromFile("./testParse.lib")
|
|||
|
||||
if ( library ) :
|
||||
# print of the library
|
||||
print library
|
||||
print(library)
|
||||
# print of one attribute in particular of a cell
|
||||
print "Area of inv_x1 :", library.getCell("inv_x1").getAttribute("area").valueAsString()
|
||||
print "Timing intrinsic_rise of nq of inv_x1 :", library.getCell("inv_x1").getPin("nq").getTiming("i").getAttribute("intrinsic_rise").valueAsString()
|
||||
print("Area of inv_x1 :", library.getCell("inv_x1").getAttribute("area").valueAsString())
|
||||
print("Timing intrinsic_rise of nq of inv_x1 :", library.getCell("inv_x1").getPin("nq").getTiming("i").getAttribute("intrinsic_rise").valueAsString())
|
||||
# print of all the attributes of a cell
|
||||
print "Attributes of no2_x1 :"
|
||||
print("Attributes of no2_x1 :")
|
||||
for attr in library.getCell("no2_x1").getAttributes() :
|
||||
print " name=", attr.key, \
|
||||
", type=", attr.value.typeToString(), \
|
||||
", value=", attr.value.valueAsString()
|
||||
print(" name=", attr.key,
|
||||
", type=", attr.value.typeToString(),
|
||||
", value=", attr.value.valueAsString())
|
||||
# print of all the timings of a pin
|
||||
print "Timing's attributes of pin nq of no2_x1 :"
|
||||
print("Timing's attributes of pin nq of no2_x1 :")
|
||||
for timing in library.getCell("no2_x1").getPin("nq").getTimings() :
|
||||
print timing
|
||||
print(timing)
|
||||
else :
|
||||
raise ( "library is NULL" )
|
||||
|
||||
|
|
|
@ -3,104 +3,104 @@ import sys
|
|||
from SPICE import *
|
||||
|
||||
def printContents(circuit):
|
||||
print "+", circuit.title
|
||||
print("+", circuit.title)
|
||||
|
||||
if len(circuit.getIncludes()):
|
||||
print "| + includes"
|
||||
print("| + includes")
|
||||
for include in circuit.getIncludes():
|
||||
print "| |", include
|
||||
print("| |", include)
|
||||
|
||||
if len(circuit.getLibraries()):
|
||||
print "| + libraries"
|
||||
print("| + libraries")
|
||||
for (lib, typ) in circuit.getLibraries():
|
||||
print "| |", lib, typ
|
||||
print("| |", lib, typ)
|
||||
|
||||
if len(circuit.getParameters()):
|
||||
print "| + parameters"
|
||||
print("| + parameters")
|
||||
for (name, value) in circuit.getParameters().items():
|
||||
print "| | %s=%s"%(name, value)
|
||||
print("| | %s=%s"%(name, value))
|
||||
|
||||
if len(circuit.getOptions()):
|
||||
print "| + options"
|
||||
print("| + options")
|
||||
for (name, value) in circuit.getOptions().items():
|
||||
print "| | %s=%s"%(name, value)
|
||||
print("| | %s=%s"%(name, value))
|
||||
|
||||
if len(circuit.getSources()):
|
||||
print "| + sources"
|
||||
print("| + sources")
|
||||
for source in circuit.getSources():
|
||||
print "| |", source.getName(), source.getPositive(), source.getNegative(), source.getValue()
|
||||
print("| |", source.getName(), source.getPositive(), source.getNegative(), source.getValue())
|
||||
|
||||
if len(circuit.getSubckts()):
|
||||
print "| + subckts"
|
||||
print("| + subckts")
|
||||
for sub in circuit.getSubckts():
|
||||
print "| | +", sub.getName(),
|
||||
print("| | +", sub.getName())
|
||||
for interf in sub.getInterfaces():
|
||||
print interf,
|
||||
print(interf)
|
||||
if len(sub.getParameters()):
|
||||
print "param:",
|
||||
print("param:")
|
||||
for (name, value) in sub.getParameters().items():
|
||||
print "%s=%s"%(name,value),
|
||||
print
|
||||
print("%s=%s"%(name,value))
|
||||
print()
|
||||
for inst in sub.getInstances():
|
||||
print "| | | +", inst.getName(),
|
||||
print("| | | +", inst.getName())
|
||||
if isinstance(inst, Mosfet):
|
||||
print inst.getDrain(), inst.getGrid(), inst.getSource(), inst.getBulk(), inst.getModel(),
|
||||
print(inst.getDrain(), inst.getGrid(), inst.getSource(), inst.getBulk(), inst.getModel())
|
||||
i = 0
|
||||
for (name, value) in inst.getParameters().items():
|
||||
if i%6 == 0:
|
||||
print
|
||||
print "| | | | +",
|
||||
print "%s=%s"%(name, value),
|
||||
print()
|
||||
print("| | | | +")
|
||||
print("%s=%s"%(name, value))
|
||||
i += 1
|
||||
elif isinstance(inst, Resistor):
|
||||
print inst.getFirst(), inst.getSecond(), inst.getValue(),
|
||||
print(inst.getFirst(), inst.getSecond(), inst.getValue())
|
||||
elif isinstance(inst, Capacitor):
|
||||
print inst.getPositive(), inst.getNegative(), inst.getValue(),
|
||||
print(inst.getPositive(), inst.getNegative(), inst.getValue())
|
||||
else:
|
||||
for conn in inst.getConnectors():
|
||||
print conn,
|
||||
print inst.getModel(),
|
||||
print(conn)
|
||||
print(inst.getModel())
|
||||
i = 0
|
||||
for (name, value) in inst.getParameters().items():
|
||||
if i%6 == 0:
|
||||
print
|
||||
print "| | | | +",
|
||||
print "%s=%s"%(name, value),
|
||||
print()
|
||||
print("| | | | +")
|
||||
print("%s=%s"%(name, value))
|
||||
i += 1
|
||||
print
|
||||
print()
|
||||
|
||||
if len(circuit.getInstances()):
|
||||
print "| + instances"
|
||||
print("| + instances")
|
||||
for inst in circuit.getInstances():
|
||||
print "| | | +", inst.getName(),
|
||||
print("| | | +", inst.getName())
|
||||
if isinstance(inst, Mosfet):
|
||||
print inst.getDrain(), inst.getGrid(), inst.getSource(), inst.getBulk(), inst.getModel(),
|
||||
print(inst.getDrain(), inst.getGrid(), inst.getSource(), inst.getBulk(), inst.getModel())
|
||||
i = 0
|
||||
for (name, value) in inst.getParameters().items():
|
||||
if i%6 == 0:
|
||||
print
|
||||
print "| | | | +",
|
||||
print "%s=%s"%(name, value),
|
||||
print()
|
||||
print("| | | | +")
|
||||
print("%s=%s"%(name, value))
|
||||
i += 1
|
||||
elif isinstance(inst, Resistor):
|
||||
print inst.getFirst(), inst.getSecond(), inst.getValue(),
|
||||
print(inst.getFirst(), inst.getSecond(), inst.getValue())
|
||||
elif isinstance(inst, Capacitor):
|
||||
print inst.getPositive(), inst.getNegative(), inst.getValue(),
|
||||
print(inst.getPositive(), inst.getNegative(), inst.getValue())
|
||||
else:
|
||||
for conn in inst.getConnectors():
|
||||
print conn,
|
||||
print inst.getModel(),
|
||||
print(conn)
|
||||
print(inst.getModel())
|
||||
i = 0
|
||||
for (name, value) in inst.getParameters().items():
|
||||
if i%6 == 0:
|
||||
print
|
||||
print "| | | | +",
|
||||
print "%s=%s"%(name, value),
|
||||
print()
|
||||
print("| | | | +")
|
||||
print("%s=%s"%(name, value))
|
||||
i += 1
|
||||
print
|
||||
print()
|
||||
|
||||
def usage():
|
||||
print "usage:", sys.argv[0], "[filename]"
|
||||
print("usage:", sys.argv[0], "[filename]")
|
||||
sys.exit(48)
|
||||
|
||||
def main():
|
||||
|
|
|
@ -23,23 +23,23 @@ try:
|
|||
import plugins.ClockTreePlugin
|
||||
import plugins.ChipPlace
|
||||
import plugins.RSavePlugin
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
serror = str(e)
|
||||
if serror.startswith('No module named'):
|
||||
module = serror.split()[-1]
|
||||
print '[ERROR] The <%s> python module or symbol cannot be loaded.' % module
|
||||
print ' Please check the integrity of the <coriolis> package.'
|
||||
print('[ERROR] The <%s> python module or symbol cannot be loaded.' % module)
|
||||
print(' Please check the integrity of the <coriolis> package.')
|
||||
sys.exit(1)
|
||||
if str(e).find('cannot open shared object file'):
|
||||
library = serror.split(':')[0]
|
||||
print '[ERROR] The <%s> shared library cannot be loaded.' % library
|
||||
print ' Under RHEL 6, you must be under devtoolset-2.'
|
||||
print ' (scl enable devtoolset-2 bash)'
|
||||
print('[ERROR] The <%s> shared library cannot be loaded.' % library)
|
||||
print(' Under RHEL 6, you must be under devtoolset-2.')
|
||||
print(' (scl enable devtoolset-2 bash)')
|
||||
sys.exit(1)
|
||||
except Exception, e:
|
||||
print '[ERROR] A strange exception occurred while loading the basic Coriolis/Python'
|
||||
print ' modules. Something may be wrong at Python/C API level.\n'
|
||||
print ' %s' % e
|
||||
except Exception as e:
|
||||
print('[ERROR] A strange exception occurred while loading the basic Coriolis/Python')
|
||||
print(' modules. Something may be wrong at Python/C API level.\n')
|
||||
print(' %s' % e)
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
|
@ -97,8 +97,8 @@ def scriptMain ( **kw ):
|
|||
|
||||
plugins.RSavePlugin.scriptMain( **kw )
|
||||
|
||||
except Exception, e:
|
||||
print helpers.io.catch( e )
|
||||
except Exception as e:
|
||||
print(helpers.io.catch( e ))
|
||||
|
||||
return success
|
||||
|
||||
|
@ -129,23 +129,23 @@ if __name__ == '__main__':
|
|||
try:
|
||||
module = __import__( options.script, globals(), locals() )
|
||||
if not module.__dict__.has_key('scriptMain'):
|
||||
print '[ERROR] Script module <%s> do not contains a ScripMain() function.' % options.script
|
||||
print('[ERROR] Script module <%s> do not contains a ScripMain() function.' % options.script)
|
||||
sys.exit(1)
|
||||
|
||||
cell = module.__dict__['scriptMain']( **kw )
|
||||
kw['cell'] = cell
|
||||
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
module = str(e).split()[-1]
|
||||
|
||||
print '[ERROR] The <%s> script cannot be loaded.' % module
|
||||
print ' Please check your design hierarchy.'
|
||||
print('[ERROR] The <%s> script cannot be loaded.' % module)
|
||||
print(' Please check your design hierarchy.')
|
||||
sys.exit(1)
|
||||
except Exception, e:
|
||||
print '[ERROR] A strange exception occurred while loading the Python'
|
||||
print ' script <%s>. Please check that module for error:\n' % options.script
|
||||
except Exception as e:
|
||||
print('[ERROR] A strange exception occurred while loading the Python')
|
||||
print(' script <%s>. Please check that module for error:\n' % options.script)
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
print ' %s' % e
|
||||
print(' %s' % e)
|
||||
sys.exit(2)
|
||||
elif options.cell:
|
||||
kw['cell'] = framework.getCell( options.cell, CRL.Catalog.State.Views )
|
||||
|
|
|
@ -98,8 +98,8 @@ class VerticalRoutingTracks ( CapacitorStack ):
|
|||
|
||||
self.setRules ()
|
||||
vRoutingTracksLayer = DataBase.getDB().getTechnology().getLayer("metal3" )
|
||||
#print 'self.capacitorInstance.doMatrix:', self.capacitorInstance.doMatrix
|
||||
#print 'self.capacitorsNumber:', self.capacitorsNumber
|
||||
#print('self.capacitorInstance.doMatrix:', self.capacitorInstance.doMatrix)
|
||||
#print('self.capacitorsNumber:', self.capacitorsNumber)
|
||||
|
||||
if self.capacitorInstance.doMatrix == True and self.capacitorsNumber > 1 :
|
||||
self.minimizeVRTs()
|
||||
|
|
|
@ -52,16 +52,16 @@ def checkCoherency ( device, bbMode ):
|
|||
columns = pmatrix.getColumns()
|
||||
|
||||
for row in range(rows):
|
||||
#print ' [',
|
||||
#print(' [')
|
||||
for column in range(columns):
|
||||
capaIndex = pmatrix.getValue(row,column)
|
||||
#print '%2d' % capaIndex,
|
||||
#print('%2d' % capaIndex)
|
||||
|
||||
if capaIndex >= capacities.getCount():
|
||||
valid = False
|
||||
message += ' element [%d,%d] == %d is out of range, must be in [0..%d]\n' \
|
||||
% (row,column,capaIndex,capacities.getCount()-1)
|
||||
#print ']'
|
||||
#print(']')
|
||||
|
||||
if not valid: return (False, message)
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class Pathes ( object ):
|
|||
def __init__ ( self, name ):
|
||||
self.name = name
|
||||
self.components = []
|
||||
if os.environ.has_key(name):
|
||||
if name in os.environ:
|
||||
self.components = os.environ[name].split(':')
|
||||
return
|
||||
|
||||
|
@ -72,9 +72,9 @@ class Pathes ( object ):
|
|||
return
|
||||
|
||||
def show ( self ):
|
||||
print ' %s:' % self.name
|
||||
print(' %s:' % self.name)
|
||||
for component in self.components:
|
||||
print ' %s' % component
|
||||
print(' %s' % component)
|
||||
return
|
||||
|
||||
|
||||
|
@ -86,38 +86,38 @@ if arch == 'x86_64' and os.path.exists('/usr/lib64'): libDir = '/lib64'
|
|||
|
||||
pythonSitePackages = os.path.join( *(distutils.sysconfig.get_python_lib(1).split('/')[-3:]) )
|
||||
|
||||
print ' ========================================'
|
||||
print ' OS:\n %s' % osType
|
||||
print(' ========================================')
|
||||
print(' OS:\n %s' % osType)
|
||||
|
||||
scriptBinPath = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||
print ' Script location:\n %s' % scriptBinPath
|
||||
print(' Script location:\n %s' % scriptBinPath)
|
||||
if scriptBinPath == '/usr/bin':
|
||||
location = Location.BaseSystem
|
||||
coriolisTop = '/usr'
|
||||
print ' Using standard system installation scheme.'
|
||||
print(' Using standard system installation scheme.')
|
||||
elif scriptBinPath == '/soc/coriolis2/bin':
|
||||
location = Location.Devtoolset2
|
||||
coriolisTop = '/soc/coriolis2'
|
||||
print ' Using RHEL6 installation scheme.'
|
||||
print(' Using RHEL6 installation scheme.')
|
||||
ldLibraryPath = os.getenv('LD_LIBRARY_PATH')
|
||||
if not 'devtoolset' in ldLibraryPath:
|
||||
print '[ERROR] You must enable the devtoolset-2 before running Coriolis:'
|
||||
print ' > scl enable devtoolset-2 bash'
|
||||
print('[ERROR] You must enable the devtoolset-2 before running Coriolis:')
|
||||
print(' > scl enable devtoolset-2 bash')
|
||||
sys.exit( 1 )
|
||||
else:
|
||||
location = Location.UserDefined
|
||||
coriolisTop = truncPath( scriptBinPath, 0, -1 )
|
||||
print ' Using User installation scheme.'
|
||||
print(' Using User installation scheme.')
|
||||
|
||||
if location & Location.SetCoriolisTop:
|
||||
os.environ['CORIOLIS_TOP'] = coriolisTop
|
||||
print ' CORIOLIS_TOP:\n %s' % coriolisTop
|
||||
print(' CORIOLIS_TOP:\n %s' % coriolisTop)
|
||||
|
||||
if location & Location.BaseSysconfDir:
|
||||
sysConfDir = truncPath( coriolisTop, 0, -1 ) + '/etc/coriolis2'
|
||||
else:
|
||||
sysConfDir = coriolisTop + '/etc/coriolis2'
|
||||
print ' Configuration directory:\n %s' % sysConfDir
|
||||
print(' Configuration directory:\n %s' % sysConfDir)
|
||||
|
||||
os.environ['STRATUS_MAPPING_NAME'] = sysConfDir+'/stratus2sxlib.xml'
|
||||
|
||||
|
@ -153,14 +153,14 @@ if len(sys.argv) > 1 and sys.argv[1].startswith('--run='):
|
|||
argvStart = 1
|
||||
slaveScript = sys.argv[1][6:]
|
||||
|
||||
print ' Script:\n %s' % slaveScript
|
||||
print ' ========================================'
|
||||
print(' Script:\n %s' % slaveScript)
|
||||
print(' ========================================')
|
||||
|
||||
try:
|
||||
os.execvp( slaveScript, sys.argv[argvStart:] )
|
||||
except Exception, e:
|
||||
print '[ERROR] An exception occured while lauching <%s>\n' % slaveScript
|
||||
print e
|
||||
except Exception as e:
|
||||
print('[ERROR] An exception occured while lauching <%s>\n' % slaveScript)
|
||||
print(e)
|
||||
sys.exit( 3 )
|
||||
|
||||
sys.exit( 0 )
|
||||
|
|
Loading…
Reference in New Issue