Migration towards Python3, first stage: still based on C-Macros.

* New: Python/C++ API level:
  * Write a new C++/template wrapper to get rid of boost::python
  * The int & long Python type are now merged. So a C/C++ level,
    it became "PyLong_X" (remove "PyInt_X") and at Python code
    level, it became "int" (remove "long").
* Change: VLSISAPD finally defunct.
  * Configuration is now integrated as a Hurricane component,
    makes use of the new C++/template wrapper.
  * vlsisapd is now defunct. Keep it in the source for now as
    some remaining non essential code may have to be ported in
    the future.
* Note: Python code (copy of the migration howto):
  * New print function syntax print().
  * Changed "dict.has_key(k)" for "k" in dict.
  * Changed "except Exception, e" for "except Exception as e".
  * The division "/" is now the floating point division, even if
    both operand are integers. So 3/2 now gives 1.5 and no longer 1.
    The integer division is now "//" : 1 = 3//2. So have to carefully
    review the code to update. Most of the time we want to use "//".
    We must never change to float for long that, in fact, represents
    DbU (exposed as Python int type).
  * execfile() must be replaced by exec(open("file").read()).
  * iter().__next__() becomes iter(x).__next__().
  * __getslice__() has been removed, integrated to __getitem__().
  * The formating used for str(type(o)) has changed, so In Stratus,
    have to update them ("<class 'MyClass'>" instead of "MyClass").
  * the "types" module no longer supply values for default types
    like str (types.StringType) or list (types.StringType).
    Must use "isinstance()" where they were occuring.
  * Remove the 'L' to indicate "long integer" (like "12L"), now
    all Python integer are long.
* Change in bootstrap:
  * Ported Coriolis builder (ccb) to Python3.
  * Ported Coriolis socInstaller.py to Python3.
  * Note: In PyQt4+Python3, QVariant no longer exists. Use None or
    directly convert using the python syntax: bool(x), int(x), ...
    By default, it is a string (str).
* Note: PyQt4 bindings & Python3 under SL7.
  * In order to compile user's must upgrade to my own rebuild of
    PyQt 4 & 5 bindings 4.19.21-1.el7.soc.
* Bug: In cumulus/plugins.block.htree.HTree.splitNet(), set the root
    buffer of the H-Tree to the original signal (mainly: top clock).
      Strangely, it was only done when working in full chip mode.
This commit is contained in:
Jean-Paul Chaput 2021-09-19 19:41:24 +02:00
parent f1668cec5f
commit 02777e127e
406 changed files with 14564 additions and 5607 deletions

View File

@ -18,10 +18,9 @@
setup_boost()
setup_qt()
find_package(PythonLibs 2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED)
find_package(FLUTE REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)
find_package(ETESIAN REQUIRED)

View File

@ -11,7 +11,7 @@ endif ( CHECK_DETERMINISM )
${FLUTE_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${QtX_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${Python_INCLUDE_DIRS}
)
set( includes anabatic/Constants.h
anabatic/Configuration.h
@ -85,7 +85,7 @@ endif ( CHECK_DETERMINISM )
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${LIBXML2_LIBRARIES}
${PYTHON_LIBRARIES} -lutil
${Python_LIBRARIES} -lutil
)
add_library( anabatic ${cpps} )

View File

@ -17,7 +17,7 @@
#include <iostream>
#include <iomanip>
#include <vector>
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h"
#include "hurricane/Error.h"
#include "hurricane/Technology.h"

View File

@ -55,17 +55,32 @@ extern "C" {
};
static PyModuleDef PyAnabatic_ModuleDef =
{ PyModuleDef_HEAD_INIT
, "Anabatic" /* m_name */
, "Low level database for global & detailed routing."
/* m_doc */
, -1 /* m_size */
, PyAnabatic_Methods /* m_methods */
, NULL /* m_reload */
, NULL /* m_traverse */
, NULL /* m_clear */
, NULL /* m_free */
};
// ---------------------------------------------------------------
// Module Initialization : "initAnabatic ()"
DL_EXPORT(void) initAnabatic () {
cdebug_log(32,0) << "initAnabatic()" << endl;
PyMODINIT_FUNC PyInit_Anabatic ( void )
{
cdebug_log(32,0) << "PyInit_Anabatic()" << endl;
PyObject* module = Py_InitModule( "Anabatic", PyAnabatic_Methods );
PyObject* module = PyModule_Create( &PyAnabatic_ModuleDef );
if (module == NULL) {
cerr << "[ERROR]\n"
<< " Failed to initialize Anabatic module." << endl;
return;
return NULL;
}
PyObject* dictionnary = PyModule_GetDict(module);
@ -77,6 +92,8 @@ extern "C" {
LoadObjectConstant( dictionnary,EngineLayerAssignByTrunk ,"EngineLayerAssignByTrunk" );
LoadObjectConstant( dictionnary,EngineLayerAssignNoGlobalM2V,"EngineLayerAssignNoGlobalM2V" );
LoadObjectConstant( dictionnary,EngineNoNetLayerAssign ,"EngineNoNetLayerAssign" );
return module;
}

View File

@ -5,12 +5,13 @@
cmake_minimum_required(VERSION 2.4.0)
set(ignoreVariables "${BUILD_DOC} ${CMAKE_INSTALL_DIR}")
set(ignoreVariables USE_LIBBFD "${BUILD_DOC} ${CMAKE_INSTALL_DIR}")
add_subdirectory(cmake_modules)
list(INSERT CMAKE_MODULE_PATH 0 "${Bootstrap_SOURCE_DIR}/cmake_modules/")
find_package(Bootstrap REQUIRED)
find_package(Bootstrap REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development )
find_package(PythonSitePackages REQUIRED)
print_cmake_module_path()
@ -23,7 +24,7 @@
OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
install(DIRECTORY builder
DESTINATION ${PYTHON_SITE_PACKAGES} )
DESTINATION ${Python_CORIOLISLIB} )
install(FILES ccb.py
DESTINATION bin

View File

@ -15,7 +15,6 @@ projects = [
, 'tools' : [ "bootstrap"
, "lefdef"
, "coloquinte"
, "vlsisapd"
, "hurricane"
, "crlcore"
, "flute"

View File

@ -2,98 +2,88 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/AboutWidget.py" |
# +-----------------------------------------------------------------+
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QPalette
from PyQt4.QtGui import QColor
from PyQt4.QtGui import QFont
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QFrame
from PyQt4.QtGui import QLabel
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QAction
from PyQt4.QtGui import QKeySequence
from PyQt4.QtGui import QApplication
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QPalette, QColor, QFont, QWidget, \
QFrame, QLabel, QVBoxLayout, QAction, \
QKeySequence, QApplication
class AboutWidget ( QWidget ):
def __init__ ( self, parent=None ):
QWidget.__init__ ( self, parent )
self.setFixedSize( 500, 400 )
self.setStyleSheet( 'background-color: #ffffdd;' )
def __init__ ( self, parent=None ):
QWidget.__init__ ( self, parent )
self.setFixedSize( 500, 400 )
self.setStyleSheet( 'background-color: #ffffdd;' )
topLine = QFrame()
topLine.setFrameShape( QFrame.HLine )
topLine.setLineWidth ( 2 )
botLine = QFrame()
botLine.setFrameShape( QFrame.HLine )
botLine.setLineWidth ( 2 )
topLine = QFrame()
topLine.setFrameShape( QFrame.HLine )
topLine.setLineWidth ( 2 )
botLine = QFrame()
botLine.setFrameShape( QFrame.HLine )
botLine.setLineWidth ( 2 )
title = QLabel( 'CCB' )
title.setAlignment( Qt.AlignCenter )
font = title.font()
font.setPointSize( 72 )
font.setWeight ( QFont.Bold )
title.setFont( font )
title = QLabel( 'CCB' )
title.setAlignment( Qt.AlignCenter )
font = title.font()
font.setPointSize( 72 )
font.setWeight ( QFont.Bold )
title.setFont( font )
subTitle = QLabel( 'Coriolis & Chams Builder for the Dummies' )
subTitle.setAlignment( Qt.AlignCenter )
subTitle.setFont( QFont('Courier',10,QFont.Bold) )
authors = QLabel( 'Coriolis CAD System 1.0 . . . . . . . . ccb 1.0\n'
'Copyright (c) 2008-2016 . . . . . . . . . . UPMC\n'
'Authors . . . . . . . . . . . . . Damien Dupuis\n'
' . . . . . . . . . . . . Jean-Paul Chaput\n'
'E-Mail . . . . . . . . Jean-Paul.Chaput@lip6.fr'
)
authors.setAlignment( Qt.AlignCenter )
authors.setFont( QFont('Courier',10,QFont.Bold) )
vLayout = QVBoxLayout()
vLayout.addStretch(10)
vLayout.addWidget( topLine )
vLayout.addWidget( title )
vLayout.addStretch(1)
vLayout.addWidget( subTitle )
vLayout.addWidget( authors )
vLayout.addStretch(1)
vLayout.addWidget( botLine )
vLayout.addStretch(10)
frame = QFrame()
frame.setFrameShape ( QFrame.Box )
frame.setFrameShadow( QFrame.Sunken )
frame.setLayout ( vLayout )
frame.setLineWidth ( 1 )
vLayout = QVBoxLayout()
vLayout.addWidget( frame )
subTitle = QLabel( 'Coriolis Toolchain Builder for the Dummies' )
subTitle.setAlignment( Qt.AlignCenter )
subTitle.setFont( QFont('Courier',10,QFont.Bold) )
authors = QLabel( 'Coriolis CAD System 3.0 . . . . . . . . ccb 1.0\n'
'Copyright (c) 2008-2021 . . Sorbonne Universite\n'
'Authors . . . . . . . . . . . . . Damien Dupuis\n'
' . . . . . . . . . . . . Jean-Paul Chaput\n'
'E-Mail . . . . . . . . Jean-Paul.Chaput@lip6.fr'
)
authors.setAlignment( Qt.AlignCenter )
authors.setFont( QFont('Courier',10,QFont.Bold) )
self.setLayout( vLayout )
self._exitAction = QAction( '&Exit', self )
self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' )
self._exitAction.setShortcut ( QKeySequence('CTRL+Q') )
self._exitAction.triggered.connect( QApplication.closeAllWindows )
self.addAction( self._exitAction )
self._closeAction = QAction( '&Close', self )
self._closeAction.setStatusTip( 'Close the About Window' )
self._closeAction.setShortcut ( QKeySequence('CTRL+A') )
self._closeAction.triggered.connect( self.close )
self.addAction( self._closeAction )
vLayout = QVBoxLayout()
vLayout.addStretch(10)
vLayout.addWidget( topLine )
vLayout.addWidget( title )
vLayout.addStretch(1)
vLayout.addWidget( subTitle )
vLayout.addWidget( authors )
vLayout.addStretch(1)
vLayout.addWidget( botLine )
vLayout.addStretch(10)
return
frame = QFrame()
frame.setFrameShape ( QFrame.Box )
frame.setFrameShadow( QFrame.Sunken )
frame.setLayout ( vLayout )
frame.setLineWidth ( 1 )
vLayout = QVBoxLayout()
vLayout.addWidget( frame )
self.setLayout( vLayout )
self._exitAction = QAction( '&Exit', self )
self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' )
self._exitAction.setShortcut ( QKeySequence('CTRL+Q') )
self._exitAction.triggered.connect( QApplication.closeAllWindows )
self.addAction( self._exitAction )
self._closeAction = QAction( '&Close', self )
self._closeAction.setStatusTip( 'Close the About Window' )
self._closeAction.setShortcut ( QKeySequence('CTRL+A') )
self._closeAction.triggered.connect( self.close )
self.addAction( self._closeAction )
return

View File

@ -1,14 +1,14 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/Builder.py" |
# +-----------------------------------------------------------------+
@ -20,9 +20,9 @@ import os
import os.path
import datetime
import subprocess
from . import ErrorMessage
from Project import Project
from Configuration import Configuration
from . import ErrorMessage
from .Project import Project
from .Configuration import Configuration
class Builder:
@ -51,14 +51,11 @@ class Builder:
self._environment = os.environ
return
def __setattr__ ( self, attribute, value ):
if attribute[0] == "_":
self.__dict__[attribute] = value
return
if attribute in self._conf.getAllIds(): setattr( self._conf, attribute, value )
if attribute == "quiet": self._quiet = value
elif attribute == "rmBuild": self._rmBuild = value
elif attribute == "doBuild": self._doBuild = value
@ -84,18 +81,15 @@ class Builder:
elif attribute == "makeArguments": self._makeArguments = value.split ()
return
def __getattr__ ( self, attribute ):
if attribute[0] != "_":
if attribute == 'conf': return self._conf
if attribute in self._conf.getAllIds():
return getattr( self._conf, attribute )
if not self.__dict__.has_key(attribute):
if not attribute in self.__dict__:
raise ErrorMessage( 1, 'Builder has no attribute <%s>.'%attribute )
return self.__dict__[attribute]
def _guessGitHash ( self, project ):
self.gitHash = 'x'
os.chdir ( self.sourceDir+'/'+project.getName() )
@ -103,58 +97,48 @@ class Builder:
self.gitHash = subprocess.Popen ( command, stdout=subprocess.PIPE ).stdout.readlines()[0]
return
def _configure ( self, fileIn, fileOut ):
fdFileIn = open ( fileIn , "r" )
fdFileOut = open ( fileOut, "w" )
for line in fdFileIn.readlines():
stable = False
substituted0 = line
while not stable:
substituted1 = re.sub ( r"@revdate@" , self.revDate, substituted0 )
substituted1 = re.sub ( r"@githash@" , self.gitHash, substituted1 )
substituted1 = re.sub ( r"@coriolisTop@", "/usr" , substituted1 )
if substituted0 == substituted1: stable = True
else: substituted0 = substituted1
fdFileOut.write ( substituted0 )
fdFileIn.close ()
fdFileOut.close ()
return
def _doSpec ( self ):
self._configure ( self.specFileIn, self.specFile )
return
def _doDebChangelog ( self ):
self._configure ( self.debChangelogIn, self.debChangelog )
return
def _execute ( self, command, error ):
collections = []
if self._devtoolset:
collections.append( 'devtoolset-%d' % self._devtoolset )
print 'Using devtoolset-%(v)d (scl enable devtoolset-%(v)d ...)' % {'v':self._devtoolset}
collections.append( 'devtoolset-{}'.format(self._devtoolset) )
print( 'Using devtoolset-{0} (scl enable devtoolset-{0} ...)'.format(self._devtoolset) )
if self._llvmtoolset:
collections.append( 'llvm-toolset-%d' % self._llvmtoolset )
print 'Using llvm-toolset-%(v)d (scl enable llvm-toolset-%(v)d ...)' % {'v':self._llvmtoolset}
collections.append( 'llvm-toolset-{}'.format(self._llvmtoolset) )
print( 'Using llvm-toolset-{0} (scl enable llvm-toolset-{v} ...)'.format(self._llvmtoolset) )
if collections:
commandAsString = ''
for i in range(len(command)):
if i: commandAsString += ' '
if ' ' in command[i]: commandAsString += '"'+command[i]+'"'
else: commandAsString += command[i]
command = [ 'scl', 'enable' ]
command += collections
command.append( commandAsString )
commandAsString = ''
for i in range(len(command)):
if i: commandAsString += ' '
if ' ' in command[i]: commandAsString += '"'+command[i]+'"'
else: commandAsString += command[i]
command = [ 'scl', 'enable' ]
command += collections
command.append( commandAsString )
sys.stdout.flush ()
sys.stderr.flush ()
child = subprocess.Popen ( command, env=self._environment, stdout=None )
@ -164,28 +148,26 @@ class Builder:
ErrorMessage( status, "%s (status:%d)."%(error,status) ).terminate()
return
def _enableTool ( self, tool ):
return
def _build ( self, tool ):
toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() )
toolBuildDir = os.path.join ( self.buildDir , tool.name )
cmakeInstallDir = os.path.join ( self.installDir, "share", "cmake", "Modules" )
# Supplied directly in the CMakeLists.txt.
#cmakeModules = os.path.join ( self.installDir, "share", "cmake", "Modules" )
if not os.path.isdir(toolSourceDir):
print ErrorMessage( 0, "Missing tool source directory: \"%s\" (skipped)."%toolSourceDir )
print( ErrorMessage( 0, 'Missing tool source directory: "{}" (skipped).' \
.format(toolSourceDir) ))
return
if self._rmBuild:
print "Removing tool build directory: \"%s\"." % toolBuildDir
print( 'Removing tool build directory: "{}".'.format(toolBuildDir) )
command = [ "/bin/rm", "-rf", toolBuildDir ]
self._execute ( command, "Removing tool build directory" )
command = [ 'cmake' ]
if self.libSuffix: command += [ "-D", "LIB_SUFFIX:STRING=%s" % self.libSuffix ]
if self._ninja: command += [ "-G", "Ninja" ]
if self._macports: command += [ "-D", "WITH_MACPORTS:STRING=TRUE" ]
if self._noSystemBoost: command += [ "-D", "Boost_NO_SYSTEM_PATHS:STRING=TRUE"
@ -195,7 +177,6 @@ class Builder:
if self._bfd: command += [ "-D", "USE_LIBBFD:STRING=%s" % self._bfd ]
if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ]
if self._openmp: command += [ "-D", "WITH_OPENMP:STRING=TRUE" ]
command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode
#, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared
, "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir
@ -203,13 +184,12 @@ class Builder:
#, "-D", "CMAKE_MODULE_PATH:STRING=%s" % cmakeModules
#, "-D", "Boost_DEBUG:STRING=TRUE"
, toolSourceDir ]
if not os.path.isdir(toolBuildDir):
print "Creating tool build directory: \"%s\"." % toolBuildDir
print( 'Creating tool build directory: "{}".'.format(toolBuildDir) )
os.makedirs ( toolBuildDir )
os.chdir ( toolBuildDir )
self._execute ( command, "First CMake failed" )
os.chdir ( toolBuildDir )
if self._noCache:
cmakeCache = os.path.join(toolBuildDir,"CMakeCache.txt")
@ -226,22 +206,19 @@ class Builder:
command += [ toolSourceDir ]
self._execute ( command, "Second CMake failed" )
if self._doBuild:
command = [ "make" ]
if self._ninja:
command = [ "ninja-build" ]
#command += [ "DESTDIR=%s" % self.installDir ]
command += self._makeArguments
print "Make/Ninja command:", command
print( "Make/Ninja command:", command )
sys.stdout.flush ()
self._execute ( command, "Build failed" )
return
def gitArchive ( self, projectName ):
rawArchive = self.tarballDir+'/'+projectName+'.tar'
os.chdir ( self.sourceDir+'/'+projectName )
command = [ 'git'
, 'archive'
@ -250,11 +227,10 @@ class Builder:
, 'devel'
]
self._execute ( command, "git archive of project %s" % projectName )
if not os.path.isdir ( self.archiveDir ):
os.mkdir ( self.archiveDir )
os.chdir ( self.archiveDir )
command = [ 'tar', 'xf', rawArchive ]
self._execute ( command, "unpacking raw archive %s" % rawArchive )
@ -265,7 +241,7 @@ class Builder:
command = [ "/bin/ln", "-s", "./coriolis/bootstrap/Makefile.package"
, self.archiveDir+"/Makefile" ]
self._execute ( command, "link of %s failed" % "coriolis/boostrap/Makefile.package")
command = [ "/bin/ln", "-s", "./coriolis/bootstrap/debian", self.archiveDir ]
self._execute ( command, "Copying Debian/Ubuntu package control files" )
@ -284,32 +260,27 @@ class Builder:
# , "--no-backup-if-mismatch"
# , "-p0", "-i", self.distribPatch ]
# self._execute ( command, "patch for distribution command failed" )
absSourceTarBz2 = '%s/%s' % (self.tarballDir,self.sourceTarBz2)
os.chdir ( self.tarballDir )
command = [ 'tar', 'jcf', absSourceTarBz2, os.path.basename(self.archiveDir) ]
self._execute ( command, "Creating composite archive %s" % absSourceTarBz2 )
return
def _setEnvironment ( self, systemVariable, userVariable ):
if not self._environment.has_key(systemVariable) or self._environment[systemVariable] == "":
if not self._environment.has_key(userVariable) or self._environment[userVariable] == "" :
if not systemVariable in self._environment or self._environment[systemVariable] == "":
if not userVariable in self._environment or self._environment[userVariable] == "" :
self._environment[ systemVariable ] = self.installDir
print "[WARNING] Neither <%s> nor <%s> environment variables are sets." \
% (systemVariable,userVariable)
print " Setting <%s> to <%s>." % (systemVariable,self.installDir)
print( '[WARNING] Neither "{0}" nor "{1}" environment variables are sets.' \
.format(systemVariable,userVariable) )
print( ' Setting "{0}" to "{1}".'.format(systemVariable,self.installDir) )
else:
self._environment[ systemVariable ] = self._environment[ userVariable ]
if not self._quiet:
print "Setting <%s> to <%s>." % (systemVariable,self._environment[systemVariable])
if self._environment.has_key(userVariable):
print "Transmitting <%s> as <%s>." % (userVariable,self._environment[userVariable])
print( 'Setting "{0}" to "{1}".'.format(systemVariable,self._environment[systemVariable]) )
if userVariable in self._environment:
print( 'Transmitting "{0}" as "{1}".'.format(userVariable,self._environment[userVariable]) )
return
def _commandTemplate ( self, tools, projects, command ):
if self._clang:
self._environment[ 'CC' ] = 'clang'
@ -320,87 +291,70 @@ class Builder:
if self._macports:
self._environment[ 'BOOST_INCLUDEDIR' ] = '/opt/local/include'
self._environment[ 'BOOST_LIBRARYDIR' ] = '/opt/local/lib'
# Set or guess the various projects TOP environment variables.
for project in self.projects:
topVariable = "%s_TOP" % project.getName().upper()
topUserVariable = "%s_USER_TOP" % project.getName().upper()
self._setEnvironment ( topVariable, topUserVariable )
if tools:
# Checks if the requested tools are in the various projects.
self.standalones = tools
for project in self.projects:
self.standalones = project.activate ( self.standalones )
for tool in self.standalones:
print "[WARNING] Tool \"%s\" is not part of any project." % tool
print( '[WARNING] Tool "{}" is not part of any project.'.format(tool) )
if projects:
for projectName in projects:
project = self.getProject ( projectName )
if not project:
ErrorMessage( 1, "No project of name \"%s\"."%projectName ).terminate()
project.activateAll()
if not tools and not projects:
for project in self.projects:
project.activateAll ()
for project in self.projects:
for tool in project.getActives():
print "\nProcessing tool: \"%s\"." % tool.name
print( '\nProcessing tool: "{}".'.format(tool.name) )
getattr(self,command) ( tool )
return
def enable ( self, tools, projects ):
self._commandTemplate ( tools, projects, "_enableTool" )
return
def enabledTools ( self ):
tools = []
for project in self.projects:
tools += project.getActives()
return tools
def build ( self, tools, projects ):
self._commandTemplate ( tools, projects, "_build" )
return
def gitTarball ( self, tools, projects ):
if self.gitHash == "x":
self._guessGitHash ( self.getProject(projects[0]) )
self._doSpec ()
# self._doDebChangelog ()
if os.path.isdir(self.tarballDir):
print "Removing previous tarball directory: \"%s\"." % self.tarballDir
print( 'Removing previous tarball directory: "{}".'.format(self.tarballDir) )
command = [ "/bin/rm", "-rf", self.tarballDir ]
self._execute ( command, "Removing top export (tarball) directory" )
print "Creating tarball directory: \"%s\"." % self.tarballDir
print( 'Creating tarball directory: "{}".'.format(self.tarballDir) )
os.makedirs ( self.tarballDir )
self.gitArchive ( projects[0] )
return
def userTarball ( self, tools, projects ):
self.enable( tools, projects )
userSourceTarBz2 = os.path.join ( self.tarballDir
, datetime.date.today().strftime('%s-%s-%%Y%%m%%d.tar.bz2'%
(self.packageName
,self.packageVersion)) )
excludes = []
for exclude in self.packageExcludes:
excludes += [ '--exclude='+exclude ]
os.chdir ( self.sourceDir )
command = [ "/bin/tar"
, "--exclude-backups"
@ -410,40 +364,34 @@ class Builder:
+ [ "-jcvf", userSourceTarBz2 ] \
+ self.enabledTools()
self._execute ( command, "tar command failed" )
return
def doRpm ( self ):
self.gitTarball ( [], self.packageProjects )
for rpmDir in [ "SOURCES", "SPECS", "BUILD", "tmp"
, "SRPMS", "RPMS/i386", "RPMS/i686", "RPMS/x86_64" ]:
rpmFullDir = os.path.join ( self.rpmbuildDir, rpmDir )
if not os.path.isdir(rpmFullDir):
os.makedirs ( rpmFullDir )
else:
for entry in os.listdir(rpmFullDir):
path = os.path.join( rpmFullDir, entry )
if os.path.islink(path):
realpath = os.path.realpath( os.readlink(path) )
if not os.path.isfile(realpath):
print 'Remove obsolete link: <%s>.' % path
os.unlink( path )
rpmFullDir = os.path.join ( self.rpmbuildDir, rpmDir )
if not os.path.isdir(rpmFullDir):
os.makedirs ( rpmFullDir )
else:
for entry in os.listdir(rpmFullDir):
path = os.path.join( rpmFullDir, entry )
if os.path.islink(path):
realpath = os.path.realpath( os.readlink(path) )
if not os.path.isfile(realpath):
print( 'Remove obsolete link: "{}".'.format(path) )
os.unlink( path )
rpmSpecFile = os.path.join ( self.rpmbuildDir, "SPECS" , "coriolis2.spec" )
rpmSourceFile = os.path.join ( self.rpmbuildDir, "SOURCES", self.sourceTarBz2 )
sourceFile = os.path.join ( self.tarballDir , self.sourceTarBz2 )
if os.path.isfile ( rpmSpecFile ):
os.unlink ( rpmSpecFile )
os.symlink ( self.specFile, rpmSpecFile )
if not os.path.islink ( rpmSourceFile ):
os.symlink ( sourceFile, rpmSourceFile )
os.chdir ( self.rpmbuildDir )
command = [ "/usr/bin/rpmbuild"
, "--define", "_topdir %s" % self.rpmbuildDir
, "--define", "_tmppath %s" % self.tmppathDir
@ -452,18 +400,13 @@ class Builder:
if self._devtoolset:
command += [ "--define", "scl devtoolset-%d"%self._devtoolset ]
command += [ "-ba", "--clean", rpmSpecFile ]
self._execute ( command, "Rebuild rpm packages" )
return
def doDeb ( self ):
self.svnTarball ( [], self.packageProjects )
if not os.path.isdir(self.debbuildDir):
os.makedirs ( self.debbuildDir )
os.chdir ( self.debbuildDir )
sourceFile = os.path.join ( self.tarballDir , self.sourceTarBz2 )
debOrigFile = os.path.join ( self.debbuildDir, "coriolis2_1.0.%s.orig.tar.bz2" % self.gitHash )
@ -478,17 +421,12 @@ class Builder:
packageDir = os.path.join ( self.debbuildDir, "coriolis2-1.0.%s" % self.gitHash )
os.chdir ( packageDir )
self._environment["CFLAGS" ] = "-O2"
self._environment["CXXFLAGS"] = "-O2"
command = [ "/usr/bin/debuild", "-us", "-uc" ]
self._execute ( command, "Rebuild Debian packages" )
return
def getProject ( self, name ): return self._conf.getProject(name)
def loadConfiguration ( self, confFile ): self._conf.load( confFile )
def showConfiguration ( self ): self._conf.show()

View File

@ -2,75 +2,72 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/BuilderGui.py" |
# +-----------------------------------------------------------------+
from PyQt4.QtGui import QTabWidget
from PyQt4.QtGui import QApplication
from PyQt4.QtGui import QMainWindow
from PyQt4.QtGui import QAction
from PyQt4.QtGui import QKeySequence
from OptionsWidget import OptionsWidget
from CompileWidget import CompileWidget
from ConfigureWidget import ConfigureWidget
from AboutWidget import AboutWidget
from PyQt4.QtGui import QTabWidget, QApplication, QMainWindow, \
QAction , QKeySequence
from .OptionsWidget import OptionsWidget
from .CompileWidget import CompileWidget
from .ConfigureWidget import ConfigureWidget
from .AboutWidget import AboutWidget
class BuilderGui ( QMainWindow ):
def __init__ ( self, confFile, parent=None ):
QMainWindow.__init__( self, parent )
self.setWindowTitle( 'Coriolis/Chams Builder' )
self._tabWidget = QTabWidget()
self._configureWidget = ConfigureWidget(confFile)
self._optionsWidget = OptionsWidget(self._configureWidget.conf)
self._compileWidget = CompileWidget()
self._aboutWidget = AboutWidget()
self._tabWidget.addTab( self._optionsWidget , 'Options' )
self._tabWidget.addTab( self._compileWidget , 'Compile' )
self._tabWidget.addTab( self._configureWidget, 'Configure' )
self.setCentralWidget( self._tabWidget )
self._compileWidget.conf = self._configureWidget
self._compileWidget.options = self._optionsWidget
self._exitAction = QAction( '&Exit', self )
self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' )
self._exitAction.setShortcut ( QKeySequence('CTRL+Q') )
self._exitAction.triggered.connect( QApplication.closeAllWindows )
self._saveAction = QAction( '&Save Settings', self )
self._saveAction.setStatusTip( 'Save Settings' )
self._saveAction.setShortcut ( QKeySequence('CTRL+S') )
self._saveAction.triggered.connect( self._configureWidget.saveSettings )
self._saveAction.triggered.connect( self._optionsWidget.saveSettings )
self._saveAction.triggered.connect( self._compileWidget.saveSettings )
self._aboutAction = QAction( '&About', self )
self._aboutAction.setStatusTip( 'A Word About Who\'s Responsible for This Thing' )
self._aboutAction.setShortcut ( QKeySequence('CTRL+A') )
self._aboutAction.triggered.connect( self._aboutWidget.show )
fileMenu = self.menuBar().addMenu( 'File' )
fileMenu.addAction( self._exitAction )
fileMenu.addAction( self._saveAction )
fileMenu.addAction( self._aboutAction )
return
def closeEvent ( self, event ):
self._configureWidget.saveSettings()
self._optionsWidget .saveSettings()
self._compileWidget .saveSettings()
event.accept()
return
def __init__ ( self, confFile, parent=None ):
QMainWindow.__init__( self, parent )
self.setWindowTitle( 'Coriolis Toolchain Builder' )
self._tabWidget = QTabWidget()
self._configureWidget = ConfigureWidget(confFile)
self._optionsWidget = OptionsWidget(self._configureWidget.conf)
self._compileWidget = CompileWidget()
self._aboutWidget = AboutWidget()
self._tabWidget.addTab( self._optionsWidget , 'Options' )
self._tabWidget.addTab( self._compileWidget , 'Compile' )
self._tabWidget.addTab( self._configureWidget, 'Configure' )
self.setCentralWidget( self._tabWidget )
self._compileWidget.conf = self._configureWidget
self._compileWidget.options = self._optionsWidget
self._exitAction = QAction( '&Exit', self )
self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' )
self._exitAction.setShortcut ( QKeySequence('CTRL+Q') )
self._exitAction.triggered.connect( QApplication.closeAllWindows )
self._saveAction = QAction( '&Save Settings', self )
self._saveAction.setStatusTip( 'Save Settings' )
self._saveAction.setShortcut ( QKeySequence('CTRL+S') )
self._saveAction.triggered.connect( self._configureWidget.saveSettings )
self._saveAction.triggered.connect( self._optionsWidget.saveSettings )
self._saveAction.triggered.connect( self._compileWidget.saveSettings )
self._aboutAction = QAction( '&About', self )
self._aboutAction.setStatusTip( 'A Word About Who\'s Responsible for This Thing' )
self._aboutAction.setShortcut ( QKeySequence('CTRL+A') )
self._aboutAction.triggered.connect( self._aboutWidget.show )
fileMenu = self.menuBar().addMenu( 'File' )
fileMenu.addAction( self._exitAction )
fileMenu.addAction( self._saveAction )
fileMenu.addAction( self._aboutAction )
return
def closeEvent ( self, event ):
self._configureWidget.saveSettings()
self._optionsWidget .saveSettings()
self._compileWidget .saveSettings()
event.accept()
return

View File

@ -2,11 +2,11 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
@ -17,195 +17,166 @@
import re
import subprocess
from PyQt4.QtCore import Qt
from PyQt4.QtCore import pyqtSignal
from PyQt4.QtCore import QSettings
from PyQt4.QtGui import QFont
from PyQt4.QtGui import QColor
from PyQt4.QtGui import QPalette
from PyQt4.QtGui import QTextCharFormat
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QLabel
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QCheckBox
from PyQt4.QtGui import QGroupBox
from PyQt4.QtGui import QButtonGroup
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QGridLayout
from PyQt4.QtGui import QScrollArea
from PyQt4.QtGui import QComboBox
from PyQt4.QtGui import QLineEdit
from PyQt4.QtGui import QTextEdit
from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QProgressBar
from PyQt4.QtGui import QApplication
from builder.Highlighter import Highlighter
from PyQt4.QtCore import Qt, pyqtSignal, QSettings
from PyQt4.QtGui import QFont, QColor, QPalette, QTextCharFormat, \
QWidget, QLabel, QPushButton, QCheckBox, \
QGroupBox, QButtonGroup, QVBoxLayout, \
QHBoxLayout, QGridLayout, QScrollArea, \
QComboBox, QLineEdit, QTextEdit, \
QFileDialog, QProgressBar, QApplication
from .Highlighter import Highlighter
class CompileWidget ( QWidget ):
progress = pyqtSignal(int)
def __init__ ( self, parent=None ):
QWidget.__init__ ( self, parent )
self._options = None
self._conf = None
self._go = QPushButton( 'Go' )
self._go.setMaximumWidth( 100 )
font = self._go.font()
font.setPointSizeF( font.pointSizeF()*2.0 )
font.setWeight ( QFont.Bold )
self._go.setFont( font )
self._go.clicked.connect( self.go )
self._saveLog = QPushButton( 'Save' )
saveLogLabel = QLabel( 'Log File:' )
saveLogBrowse = QPushButton( '&Browse' )
saveLogBrowse.clicked.connect( self.browseSaveLog )
self._saveLogEdit = QLineEdit( '' )
gLayout = QGridLayout()
gLayout.addWidget( saveLogLabel , 0, 0, 1, 1, Qt.AlignRight )
gLayout.addWidget( self._saveLogEdit, 0, 1, 1, 6 )
gLayout.addWidget( saveLogBrowse , 0, 7, 1, 1 )
self._console = QTextEdit()
self._console.setLineWrapMode( QTextEdit.NoWrap )
self._console.setMinimumSize ( 800, 400 )
palette = self._console.palette()
palette.setColor( QPalette.Base, QColor.fromRgb(255,255,221) ) # ffffdd.
self._console.setPalette( palette )
font = QFont( 'Bitstream Vera Sans Mono', self._console.font().pointSize() )
self._console.setFont( font )
self._highlighter = Highlighter( self._console.document() )
self._progressBar = QProgressBar()
self._progressBar.setRange ( 0, 100 )
self._progressBar.setTextVisible( True )
hLayout = QHBoxLayout()
hLayout.addStretch()
hLayout.addWidget( self._go )
hLayout.addStretch()
hLayout.addWidget( self._saveLog )
hLayout.addStretch()
vLayout = QVBoxLayout()
vLayout.addLayout( hLayout )
vLayout.addLayout( gLayout )
vLayout.addWidget( self._progressBar )
vLayout.addWidget( self._console )
self.setLayout( vLayout )
self.progress.connect( self._progressBar.setValue )
self._saveLog.clicked.connect( self.saveLog )
self.readSettings()
return
def _setOptions ( self, options ): self._options = options
def _setConf ( self, conf ): self._conf = conf
def _getOptions ( self ): return self._options
def _getConf ( self ): return self._conf
options = property( _getOptions, _setOptions )
conf = property( _getConf , _setConf )
def browseSaveLog ( self ):
self._saveLogEdit.setText( QFileDialog.getSaveFileName(self
,'Select Log File Report'
,self._saveLogEdit.text()
,'Report Files (*.log *.txt)') )
return
def saveLog ( self ):
if self._saveLogEdit.text():
fd = open( self._saveLogEdit.text(), 'w+' )
fd.write( self._console.toPlainText() )
fd.close()
return
def shellCommand ( self ):
command = [ self.conf.bootstrapDir+'/ccb.py' ]
for project in self.options.projects:
for tool in project.actives:
command += [ '--tool='+tool ]
toolsCount = len(command) - 1
if self.conf.rootDir: command += [ '--root=%s'%self.conf.rootDir ]
#if self.options.svnUpdate: command += [ '--svn-update' ]
#if self.options.svnStatus: command += [ '--svn-update' ]
if self.options.enableDoc: command += [ '--doc' ]
if self.options.devtoolset: command += [ '--devtoolset-8' ]
if self.options.qt5: command += [ '--qt5' ]
if self.options.noCache: command += [ '--no-cache' ]
if self.options.rmBuild: command += [ '--rm-build' ]
if self.options.verbose: command += [ '--verbose' ]
if self.options.make:
makeArguments='install '+self.options.threads
command += [ '--make=%s'%makeArguments ]
progress = pyqtSignal(int)
def __init__ ( self, parent=None ):
QWidget.__init__ ( self, parent )
self._options = None
self._conf = None
if self.options.buildMode == 'Debug':
command += [ '--debug' ]
return toolsCount, command
def go ( self ):
rePercentage = re.compile(r'^\[\s*(?P<percent>\d+)%\].*')
reProcessTool = re.compile(r'^Processing tool:\s*"(?P<tool>.+)"')
if not self.options or not self.conf: return
toolsCount, command = self.shellCommand()
if not toolsCount: return
self._progressBar.reset()
self._progressBar.setRange( 0, toolsCount*100 )
strCommand = command[0]
for arg in command[1:]:
strCommand += ' ' + arg
strCommand += '\n\n'
self._console.setFontItalic( True )
self._console.insertPlainText( strCommand )
self._console.setFontItalic( False )
toolsDone = -1
builderProcess = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
while True:
line = builderProcess.stdout.readline()
if line == '': break
m = rePercentage.match( line )
if m:
self.progress.emit( toolsDone*100+int(m.group('percent')) )
else:
m = reProcessTool.match( line )
if m:
toolsDone += 1
self._console.insertPlainText( line )
scrollBar = self._console.verticalScrollBar()
scrollBar.setValue( scrollBar.maximum() )
QApplication.processEvents()
builderProcess.wait()
if builderProcess.returncode == None:
pass
return
def readSettings ( self ):
settings = QSettings()
self._saveLogEdit.setText( settings.value('compile/saveLog').toString() )
return
def saveSettings ( self ):
settings = QSettings()
settings.setValue( 'compile/saveLog', self._saveLogEdit.text() )
return
self._go = QPushButton( 'Go' )
self._go.setMaximumWidth( 100 )
font = self._go.font()
font.setPointSizeF( font.pointSizeF()*2.0 )
font.setWeight ( QFont.Bold )
self._go.setFont( font )
self._go.clicked.connect( self.go )
self._saveLog = QPushButton( 'Save' )
saveLogLabel = QLabel( 'Log File:' )
saveLogBrowse = QPushButton( '&Browse' )
saveLogBrowse.clicked.connect( self.browseSaveLog )
self._saveLogEdit = QLineEdit( '' )
gLayout = QGridLayout()
gLayout.addWidget( saveLogLabel , 0, 0, 1, 1, Qt.AlignRight )
gLayout.addWidget( self._saveLogEdit, 0, 1, 1, 6 )
gLayout.addWidget( saveLogBrowse , 0, 7, 1, 1 )
self._console = QTextEdit()
self._console.setLineWrapMode( QTextEdit.NoWrap )
self._console.setMinimumSize ( 800, 400 )
palette = self._console.palette()
palette.setColor( QPalette.Base, QColor.fromRgb(255,255,221) ) # ffffdd.
self._console.setPalette( palette )
font = QFont( 'Bitstream Vera Sans Mono', self._console.font().pointSize() )
self._console.setFont( font )
self._highlighter = Highlighter( self._console.document() )
self._progressBar = QProgressBar()
self._progressBar.setRange ( 0, 100 )
self._progressBar.setTextVisible( True )
hLayout = QHBoxLayout()
hLayout.addStretch()
hLayout.addWidget( self._go )
hLayout.addStretch()
hLayout.addWidget( self._saveLog )
hLayout.addStretch()
vLayout = QVBoxLayout()
vLayout.addLayout( hLayout )
vLayout.addLayout( gLayout )
vLayout.addWidget( self._progressBar )
vLayout.addWidget( self._console )
self.setLayout( vLayout )
self.progress.connect( self._progressBar.setValue )
self._saveLog.clicked.connect( self.saveLog )
self.readSettings()
return
def _setOptions ( self, options ): self._options = options
def _setConf ( self, conf ): self._conf = conf
def _getOptions ( self ): return self._options
def _getConf ( self ): return self._conf
options = property( _getOptions, _setOptions )
conf = property( _getConf , _setConf )
def browseSaveLog ( self ):
self._saveLogEdit.setText( QFileDialog.getSaveFileName( self
, 'Select Log File Report'
, self._saveLogEdit.text()
, 'Report Files (*.log *.txt)' ) )
return
def saveLog ( self ):
if self._saveLogEdit.text():
fd = open( self._saveLogEdit.text(), 'w+' )
fd.write( self._console.toPlainText() )
fd.close()
return
def shellCommand ( self ):
command = [ self.conf.bootstrapDir+'/ccb.py' ]
for project in self.options.projects:
for tool in project.actives:
command += [ '--tool='+tool ]
toolsCount = len(command) - 1
if self.conf.rootDir: command += [ '--root=%s'%self.conf.rootDir ]
#if self.options.svnUpdate: command += [ '--svn-update' ]
#if self.options.svnStatus: command += [ '--svn-update' ]
if self.options.enableDoc: command += [ '--doc' ]
if self.options.devtoolset: command += [ '--devtoolset-8' ]
if self.options.qt5: command += [ '--qt5' ]
if self.options.noCache: command += [ '--no-cache' ]
if self.options.rmBuild: command += [ '--rm-build' ]
if self.options.verbose: command += [ '--verbose' ]
if self.options.make:
makeArguments='install '+self.options.threads
command += [ '--make=%s'%makeArguments ]
if self.options.buildMode == 'Debug':
command += [ '--debug' ]
return toolsCount, command
def go ( self ):
rePercentage = re.compile(r'^\[\s*(?P<percent>\d+)%\].*')
reProcessTool = re.compile(r'^Processing tool:\s*"(?P<tool>.+)"')
if not self.options or not self.conf: return
toolsCount, command = self.shellCommand()
if not toolsCount: return
self._progressBar.reset()
self._progressBar.setRange( 0, toolsCount*100 )
strCommand = command[0]
for arg in command[1:]:
strCommand += ' ' + arg
strCommand += '\n\n'
self._console.setFontItalic( True )
self._console.insertPlainText( strCommand )
self._console.setFontItalic( False )
toolsDone = -1
builderProcess = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
while True:
line = builderProcess.stdout.readline()
if line == '': break
m = rePercentage.match( line )
if m:
self.progress.emit( toolsDone*100+int(m.group('percent')) )
else:
m = reProcessTool.match( line )
if m:
toolsDone += 1
self._console.insertPlainText( line )
scrollBar = self._console.verticalScrollBar()
scrollBar.setValue( scrollBar.maximum() )
QApplication.processEvents()
builderProcess.wait()
if builderProcess.returncode == None:
pass
return
def readSettings ( self ):
settings = QSettings()
self._saveLogEdit.setText( settings.value('compile/saveLog') )
return
def saveSettings ( self ):
settings = QSettings()
settings.setValue( 'compile/saveLog', self._saveLogEdit.text() )
return

View File

@ -2,14 +2,14 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2008-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/Configuration.py" |
# +-----------------------------------------------------------------+
@ -21,8 +21,8 @@ import os
import os.path
import datetime
import subprocess
from . import ErrorMessage
from Project import Project
from . import ErrorMessage
from .Project import Project
class Configuration ( object ):
@ -64,31 +64,26 @@ class Configuration ( object ):
self._updateSecondary()
return
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 "{}" in Configuration.' \
.format(attribute) ))
return
if attribute[0] == '_':
self.__dict__[attribute] = value
return
if attribute == 'rootDir': value = os.path.expanduser(value)
elif attribute == 'enableShared' and value != 'ON': value = 'OFF'
self.__dict__['_'+attribute] = value
self._updateSecondary()
return
def __getattr__ ( self, attribute ):
if attribute[0] != '_': attribute = '_'+attribute
if not self.__dict__.has_key(attribute):
if not attribute in self.__dict__:
raise ErrorMessage( 1, 'Configuration has no attribute <%s>.'%attribute )
return self.__dict__[attribute]
def _updateSecondary ( self ):
if self._enableShared == "ON": self._libMode = "Shared"
else: self._libMode = "Static"
@ -109,7 +104,6 @@ class Configuration ( object ):
, "%s.%s" % (self._buildMode,self._libMode) )
self._buildDir = os.path.join ( self._osDir, "build" )
self._installDir = os.path.join ( self._osDir, "install" )
self._specFileIn = os.path.join ( self._bootstrapDir, "%s.spec.in"%self._packageName )
self._specFile = os.path.join ( self._bootstrapDir, "%s.spec" %self._packageName )
self._debianDir = os.path.join ( self._bootstrapDir, "debian" )
@ -126,7 +120,6 @@ class Configuration ( object ):
self._distribPatch = os.path.join ( self._sourceDir, "bootstrap", "%s-for-distribution.patch"%self._packageName )
return
def _guessOs ( self ):
self._libSuffix = None
self._osSlsoc7x_64 = re.compile (".*Linux.*(el7|slsoc7).*x86_64.*")
@ -149,95 +142,89 @@ class Configuration ( object ):
self._osCygwinW10_64 = re.compile (".*CYGWIN_NT-10\.[0-3].*x86_64.*")
self._osCygwinW10 = re.compile (".*CYGWIN_NT-10\.[0-3].*i686.*")
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines()
if self._osSlsoc7x_64.match(lines[0]):
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines()
osLine = lines[0].decode( 'ascii' )
if self._osSlsoc7x_64.match(osLine):
self._osType = "Linux.el7_64"
self._libSuffix = "64"
elif self._osSlsoc6x_64.match(lines[0]):
elif self._osSlsoc6x_64.match(osLine):
self._osType = "Linux.slsoc6x_64"
self._libSuffix = "64"
elif self._osSlsoc6x .match(lines[0]): self._osType = "Linux.slsoc6x"
elif self._osSLSoC5x_64.match(lines[0]):
elif self._osSlsoc6x .match(osLine): self._osType = "Linux.slsoc6x"
elif self._osSLSoC5x_64.match(osLine):
self._osType = "Linux.SLSoC5x_64"
self._libSuffix = "64"
elif self._osSLSoC5x .match(lines[0]): self._osType = "Linux.SLSoC5x"
elif self._osFedora_64 .match(lines[0]):
elif self._osSLSoC5x .match(osLine): self._osType = "Linux.SLSoC5x"
elif self._osFedora_64 .match(osLine):
self._osType = "Linux.fc_64"
self._libSuffix = "64"
elif self._osFedora .match(lines[0]): self._osType = "Linux.fc"
elif self._osLinux_64 .match(lines[0]):
elif self._osFedora .match(osLine): self._osType = "Linux.fc"
elif self._osLinux_64 .match(osLine):
self._osType = "Linux.x86_64"
if os.path.exists("/usr/lib64/"):
self._libSuffix = "64"
elif self._osLinux .match(lines[0]): self._osType = "Linux.i386"
elif self._osDarwin .match(lines[0]): self._osType = "Darwin"
elif self._osFreeBSD8x_amd64.match(lines[0]):
elif self._osLinux .match(osLine): self._osType = "Linux.i386"
elif self._osDarwin .match(osLine): self._osType = "Darwin"
elif self._osFreeBSD8x_amd64.match(osLine):
self._osType = "FreeBSD.8x.amd64"
self._libSuffix = "64"
elif self._osFreeBSD8x_64.match(lines[0]):
elif self._osFreeBSD8x_64.match(osLine):
self._osType = "FreeBSD.8x.x86_64"
self._libSuffix = "64"
elif self._osFreeBSD8x .match(lines[0]): self._osType = "FreeBSD.8x.i386"
elif self._osCygwinW7_64.match(lines[0]):
elif self._osFreeBSD8x .match(osLine): self._osType = "FreeBSD.8x.i386"
elif self._osCygwinW7_64.match(osLine):
self._osType = "Cygwin.W7_64"
self._libSuffix = "64"
elif self._osCygwinW7.match(lines[0]): self._osType = "Cygwin.W7"
elif self._osCygwinW8_64.match(lines[0]):
elif self._osCygwinW7.match(osLine): self._osType = "Cygwin.W7"
elif self._osCygwinW8_64.match(osLine):
self._osType = "Cygwin.W8_64"
self._libSuffix = "64"
elif self._osCygwinW8.match(lines[0]): self._osType = "Cygwin.W8"
elif self._osCygwinW10_64.match(lines[0]):
elif self._osCygwinW8.match(osLine): self._osType = "Cygwin.W8"
elif self._osCygwinW10_64.match(osLine):
self._osType = "Cygwin.W10_64"
self._libSuffix = "64"
elif self._osCygwinW10.match(lines[0]): self._osType = "Cygwin.W10"
elif self._osCygwinW10.match(osLine): self._osType = "Cygwin.W10"
else:
uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE )
self._osType = uname.stdout.readlines()[0][:-1]
print "[WARNING] Unrecognized OS: \"%s\"." % lines[0][:-1]
print " (using: \"%s\")" % self._osType
print( '[WARNING] Unrecognized OS: "{}."'.format(osLine[:-1]) )
print( ' (using: "{}")'.format(self._osType) )
if self._libSuffix == '64' and not os.path.exists('/usr/lib64'):
self._libSuffix = None
return
def getPrimaryIds ( self ): return Configuration.PrimaryNames
def getSecondaryIds ( self ): return Configuration.SecondaryNames
def getAllIds ( self ): return Configuration.PrimaryNames + Configuration.SecondaryNames
def register ( self, project ):
for registered in self._projects:
if registered.getName() == project.getName():
print ErrorMessage( 0, "Project \"%s\" is already registered (ignored)." )
print( ErrorMessage( 0, 'Project "{}" is already registered (ignored).'.format(project.getName()) ))
return
self._projects += [ project ]
return
def getProject ( self, name ):
for project in self._projects:
if project.getName() == name:
return project
return None
def getToolProject ( self, name ):
for project in self._projects:
if project.hasTool(name):
return project
return None
def load ( self, confFile ):
moduleGlobals = globals()
if not confFile:
print 'Making an educated guess to locate the configuration file:'
print( 'Making an educated guess to locate the configuration file:' )
locations = [ os.path.abspath(os.path.dirname(sys.argv[0]))
, os.environ['HOME']+'/coriolis-2.x/src/coriolis/bootstrap'
, os.environ['HOME']+'/coriolis/src/coriolis/bootstrap'
@ -247,86 +234,82 @@ class Configuration ( object ):
for location in locations:
self._confFile = location + '/build.conf'
print ' <%s>' % self._confFile
print( ' "{}"'.format(self._confFile) )
if os.path.isfile(self._confFile): break
if not self._confFile:
ErrorMessage( 1, 'Cannot locate any configuration file.' ).terminate()
else:
print 'Using user-supplied configuration file:'
print ' <%s>' % confFile
print( 'Using user-supplied configuration file:' )
print( ' "{}"'.format(confFile) )
self._confFile = confFile
if not os.path.isfile(self._confFile):
ErrorMessage( 1, 'Missing configuration file:', '<%s>'%self._confFile ).terminate()
print 'Reading configuration from:'
print ' <%s>' % self._confFile
print( 'Reading configuration from:' )
print( ' "{}"'.format(self._confFile) )
try:
execfile( self._confFile, moduleGlobals )
except Exception, e:
exec( open(self._confFile).read(), globals() )
except Exception as e:
ErrorMessage( 1, 'An exception occured while loading the configuration file:'
, '<%s>\n' % (self._confFile)
, 'You should check for simple python errors in this file.'
, 'Error was:'
, '%s\n' % e ).terminate()
if moduleGlobals.has_key('projects'):
if 'projects' in moduleGlobals:
entryNb = 0
for entry in moduleGlobals['projects']:
entryNb += 1
if not entry.has_key('name'):
if not 'name' in entry:
raise ErrorMessage( 1, 'Missing project name in project entry #%d.' % entryNb )
if not entry.has_key('tools'):
if not 'tools' in entry:
raise ErrorMessage( 1, 'Missing tools list in project entry #%d (<%s>).' \
% (entryNb,entry['name']) )
if not isinstance(entry['tools'],list):
raise ErrorMessage( 1, 'Tools item of project entry #%d (<%s>) is not a list.' \
% (entryNb,entry['name']) )
if not entry.has_key('repository'):
if not 'repository' in entry:
raise ErrorMessage( 1, 'Missing project repository in project entry #%d.' \
% entryNb )
self.register( Project(entry['name'],entry['tools'],entry['repository']) )
else:
ErrorMessage( 1, 'Configuration file is missing the \'project\' symbol.'
, '<%s>'%self._confFile ).terminate()
ErrorMessage( 1, 'Configuration file is missing the "project" symbol.'
, '"{}"'.format(self._confFile) ).terminate()
if moduleGlobals.has_key('projectdir'):
if 'projectdir' in moduleGlobals:
self.projectDir = moduleGlobals['projectdir']
if moduleGlobals.has_key('svnconfig'):
if 'svnconfig' in moduleGlobals:
svnconfig = moduleGlobals['svnconfig']
if svnconfig.has_key('method'): self._svnMethod = svnconfig['method']
if moduleGlobals.has_key('package'):
if 'method' in svnconfig: self._svnMethod = svnconfig['method']
if 'package' in moduleGlobals:
package = moduleGlobals['package']
if package.has_key('name' ): self.packageName = package['name']
if package.has_key('version' ): self.packageVersion = package['version']
if package.has_key('excludes'):
if 'name' in package: self.packageName = package['name']
if 'version' in package: self.packageVersion = package['version']
if 'excludes' in package:
if not isinstance(package['excludes'],list):
raise ErrorMessage( 1, 'Excludes of package configuration is not a list.')
self._packageExcludes = package['excludes']
if package.has_key('projects'):
if 'projects' in package:
if not isinstance(package['projects'],list):
raise ErrorMessage( 1, 'Projects to package is not a list.')
self._packageProjects = package['projects']
return
def show ( self ):
print 'CCB Configuration:'
print( 'CCB Configuration:' )
if self._gitMethod:
print ' Git Method: <%s>' % self._gitMethod
print( ' Git Method: "{}"'.format(self._gitMethod) )
else:
print ' Git Method not defined, will not be able to push/pull.'
print( ' Git Method not defined, will not be able to push/pull.' )
for project in self._projects:
print ' project:%-15s repository:<%s>' % ( ('<%s>'%project.getName()), project.getRepository() )
print( ' project:{0:>15} repository:"{1}"' \
.format( '"{}"'.format(project.getName()), project.getRepository() ))
toolOrder = 1
for tool in project.getTools():
print '%s%02d:<%s>' % (' '*26,toolOrder,tool)
print( '{0}{1:02}:"{2}"'.format( ' '*26, toolOrder, tool ))
toolOrder += 1
print
return

View File

@ -2,45 +2,32 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/ConfigureWidget.py" |
# +-----------------------------------------------------------------+
from PyQt4.QtCore import Qt
from PyQt4.QtCore import QVariant
from PyQt4.QtCore import pyqtSignal
from PyQt4.QtCore import QSettings
from PyQt4.QtGui import QFont
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QGridLayout
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QLabel
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QLineEdit
from PyQt4.QtCore import QModelIndex
from PyQt4.QtCore import QAbstractTableModel
from PyQt4.QtGui import QAbstractItemView
from PyQt4.QtGui import QHeaderView
from PyQt4.QtGui import QTableView
from PyQt4.QtGui import QGroupBox
from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QApplication
from Configuration import Configuration
from PyQt4.QtCore import Qt, QVariant, pyqtSignal, QSettings, \
QModelIndex, QAbstractTableModel
from PyQt4.QtGui import QFont, QWidget, QGridLayout, QHBoxLayout, \
QVBoxLayout, QLabel, QPushButton, \
QLineEdit, QAbstractItemView, QHeaderView, \
QTableView, QGroupBox, QFileDialog, \
QApplication
from .Configuration import Configuration
class ConfSettingsModel ( QAbstractTableModel ):
HeaderFont = QApplication.font()
HeaderFont = QApplication.font()
PrimaryFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Normal)
SecondaryFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Normal)
ValueFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Bold)
@ -48,7 +35,6 @@ class ConfSettingsModel ( QAbstractTableModel ):
def __init__ ( self, conf, parent=None ):
ConfSettingsModel.HeaderFont.setBold( True )
ConfSettingsModel.SecondaryFont.setItalic( True )
QAbstractTableModel.__init__( self, parent )
self._conf = conf
self._ids = self._conf.getAllIds()
@ -70,20 +56,15 @@ class ConfSettingsModel ( QAbstractTableModel ):
if row < self.rowCount():
if index.column() == 0: return self._ids[row]
elif index.column() == 1: return getattr( self._conf, self._ids[row] )
return QVariant()
return None
def headerData ( self, section, orientation, role ):
if orientation == Qt.Vertical: return QVariant()
if orientation == Qt.Vertical: return None
if role == Qt.FontRole: return ConfSettingsModel.HeaderFont
if role != Qt.DisplayRole: return QVariant()
if role != Qt.DisplayRole: return None
if section == 0: return 'Setting'
elif section == 1: return 'Value'
return QVariant('?')
return '?'
def rowCount ( self, index=QModelIndex() ): return len(self._ids)
def columnCount ( self, index=QModelIndex() ): return 2
@ -119,79 +100,73 @@ class ConfSettingsWidget ( QWidget ):
peanoDataLayout = QGridLayout();
peanoDataLayout.addWidget( self._view, 0, 0, 1, 1 );
self.setLayout ( peanoDataLayout );
return
class ConfigureWidget ( QWidget ):
def __init__ ( self, confFile, parent=None ):
QWidget.__init__ ( self, parent )
self._confFile = confFile
self._conf = Configuration()
self._rootDir = ''
rootDirLabel = QLabel( 'Root Directory' )
rootDirBrowse = QPushButton( '&Browse' )
rootDirBrowse.clicked.connect( self.browseRootDir )
self._rootDirEdit = QLineEdit( '' )
#self._rootDirEdit.setFixedWidth( 600 )
gLayout = QGridLayout()
gLayout.addWidget( rootDirLabel , 0, 0, 1, 1 )
gLayout.addWidget( self._rootDirEdit, 0, 1, 1, 6 )
gLayout.addWidget( rootDirBrowse , 0, 7, 1, 1 )
groupDirs = QGroupBox( 'Directories' )
groupDirs.setLayout( gLayout )
gLayout = QGridLayout()
groupConf = QGroupBox( 'Configuration' )
groupConf.setLayout( gLayout )
vLayout = QVBoxLayout()
vLayout.addWidget ( groupDirs )
vLayout.addWidget ( groupConf )
#vLayout.addStretch()
self.setLayout( vLayout )
self._rootDirEdit.textChanged.connect( self.rootDirChanged )
self.readSettings()
noteLabel = QLabel( 'Those settings can be changed only by editing build.conf' )
gLayout.addWidget( noteLabel , 0, 0, 1, 1 )
gLayout.addWidget( ConfSettingsWidget(self._conf), 1, 0, 1, 1 )
def _getConf ( self ): return self._conf
def _getRootDir ( self ): return self._rootDir
def _getBootstrapDir ( self ): return self._getConf().bootstrapDir
conf = property( _getConf )
rootDir = property( _getRootDir )
bootstrapDir = property( _getBootstrapDir )
def rootDirChanged ( self, rootDir ):
self._rootDir = rootDir
return
def browseRootDir ( self ):
self._rootDirEdit.setText( QFileDialog.getExistingDirectory(self,'Select the Building Root Directory') )
return
def readSettings ( self ):
settings = QSettings()
self._rootDirEdit.setText( settings.value('conf/rootDir').toString() )
if not self._confFile and settings.value('conf/confFile'):
self._confFile = str( settings.value('conf/confFile').toString() )
self._conf.load( self._confFile )
return
def saveSettings ( self ):
settings = QSettings()
settings.setValue( 'conf/rootDir' , self._rootDirEdit.text() )
settings.setValue( 'conf/confFile', self._confFile )
return
def __init__ ( self, confFile, parent=None ):
QWidget.__init__ ( self, parent )
self._confFile = confFile
self._conf = Configuration()
self._rootDir = ''
rootDirLabel = QLabel( 'Root Directory' )
rootDirBrowse = QPushButton( '&Browse' )
rootDirBrowse.clicked.connect( self.browseRootDir )
self._rootDirEdit = QLineEdit( '' )
#self._rootDirEdit.setFixedWidth( 600 )
gLayout = QGridLayout()
gLayout.addWidget( rootDirLabel , 0, 0, 1, 1 )
gLayout.addWidget( self._rootDirEdit, 0, 1, 1, 6 )
gLayout.addWidget( rootDirBrowse , 0, 7, 1, 1 )
groupDirs = QGroupBox( 'Directories' )
groupDirs.setLayout( gLayout )
gLayout = QGridLayout()
groupConf = QGroupBox( 'Configuration' )
groupConf.setLayout( gLayout )
vLayout = QVBoxLayout()
vLayout.addWidget ( groupDirs )
vLayout.addWidget ( groupConf )
#vLayout.addStretch()
self.setLayout( vLayout )
self._rootDirEdit.textChanged.connect( self.rootDirChanged )
self.readSettings()
noteLabel = QLabel( 'Those settings can be changed only by editing build.conf' )
gLayout.addWidget( noteLabel , 0, 0, 1, 1 )
gLayout.addWidget( ConfSettingsWidget(self._conf), 1, 0, 1, 1 )
def _getConf ( self ): return self._conf
def _getRootDir ( self ): return self._rootDir
def _getBootstrapDir ( self ): return self._getConf().bootstrapDir
conf = property( _getConf )
rootDir = property( _getRootDir )
bootstrapDir = property( _getBootstrapDir )
def rootDirChanged ( self, rootDir ):
self._rootDir = rootDir
return
def browseRootDir ( self ):
self._rootDirEdit.setText( QFileDialog.getExistingDirectory(self,'Select the Building Root Directory') )
return
def readSettings ( self ):
settings = QSettings()
self._rootDirEdit.setText( settings.value('conf/rootDir') )
if not self._confFile and settings.value('conf/confFile'):
self._confFile = str( settings.value('conf/confFile') )
self._conf.load( self._confFile )
return
def saveSettings ( self ):
settings = QSettings()
settings.setValue( 'conf/rootDir' , self._rootDirEdit.text() )
settings.setValue( 'conf/confFile', self._confFile )
return

View File

@ -2,14 +2,14 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/Highlighter.py" |
# +-----------------------------------------------------------------+
@ -17,64 +17,61 @@
import re
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QFont
from PyQt4.QtGui import QColor
from PyQt4.QtGui import QTextCharFormat
from PyQt4.QtGui import QSyntaxHighlighter
from PyQt4.QtGui import QFont, QColor, QTextCharFormat, QSyntaxHighlighter
class Highlighter ( QSyntaxHighlighter ):
Normal = 0x0001
Bold = 0x0002
Italic = 0x0004
ttyBackground = QColor.fromRgb( 255, 255, 221 ) # #ffffdd
ttyBlack = QColor.fromRgb( 46, 52, 54 ) # #2e3436
ttyRed = QColor.fromRgb( 204, 0, 0 ) # #cc0000
ttyGreen = QColor.fromRgb( 78, 154, 6 ) # #4e9a06
ttyYellow = QColor.fromRgb( 196, 160, 0 ) # #c4a000
ttyBlue = QColor.fromRgb( 52, 101, 164 ) # #3465a4
ttyViolet = QColor.fromRgb( 117, 80, 123 ) # #75507b
ttyCyan = QColor.fromRgb( 6, 152, 154 ) # #06989a
ttyGrey = QColor.fromRgb( 211, 215, 207 ) # #d3d7cf
ttyLightBlack = QColor.fromRgb( 85, 87, 83 ) # #555753
ttyLightRed = QColor.fromRgb( 239, 41, 41 ) # #ef2929
ttyLightGreen = QColor.fromRgb( 138, 226, 52 ) # #8ae234
ttyLightYellow = QColor.fromRgb( 252, 233, 79 ) # #fce94f
ttyLightBlue = QColor.fromRgb( 114, 159, 207 ) # #729fcf
ttyLightViolet = QColor.fromRgb( 173, 127, 168 ) # #ad7fa8
ttyLightCyan = QColor.fromRgb( 52, 226, 226 ) # #34e2e2
ttyLightGrey = QColor.fromRgb( 238, 238, 236 ) # #eeeeec
Rules = [ [ttyLightViolet, Bold , re.compile(r'^Scanning.*'), None]
, [ttyLightRed , Bold , re.compile(r'^Linking.*'), None]
, [ttyLightGreen , Normal , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Building.*)'), None]
, [ttyLightGreen , Bold , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Built target.*)'), None]
, [ttyLightBlue , Normal , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Generating.*moc_.*)'), None]
, [ttyLightBlue , Bold , re.compile(r'^Generating.*'), None]
, [ttyLightCyan , Normal , re.compile(r'^Install the project.*'), None]
, [ttyCyan , Bold , re.compile(r'^-- Install.*'), None]
, [ttyCyan , Bold|Italic, re.compile(r'^-- Up-to-date.*'), None]
]
def __init__ ( self, parent=None ):
QSyntaxHighlighter.__init__ ( self, parent )
for rule in Highlighter.Rules:
if not rule[3]:
rule[3] = QTextCharFormat()
rule[3].setForeground( rule[0] )
if rule[1] & Highlighter.Normal: rule[3].setFontWeight( QFont.Normal )
if rule[1] & Highlighter.Bold: rule[3].setFontWeight( QFont.Bold )
if rule[1] & Highlighter.Italic: rule[3].setFontItalic( True )
return
def highlightBlock ( self, line ):
for rule in Highlighter.Rules:
m = rule[2].match(line)
if m:
if m.groupdict().has_key('percent'):
self.setFormat( 7, len(line), rule[3] )
else:
self.setFormat( 0, len(line), rule[3] )
return
Normal = 0x0001
Bold = 0x0002
Italic = 0x0004
ttyBackground = QColor.fromRgb( 255, 255, 221 ) # #ffffdd
ttyBlack = QColor.fromRgb( 46, 52, 54 ) # #2e3436
ttyRed = QColor.fromRgb( 204, 0, 0 ) # #cc0000
ttyGreen = QColor.fromRgb( 78, 154, 6 ) # #4e9a06
ttyYellow = QColor.fromRgb( 196, 160, 0 ) # #c4a000
ttyBlue = QColor.fromRgb( 52, 101, 164 ) # #3465a4
ttyViolet = QColor.fromRgb( 117, 80, 123 ) # #75507b
ttyCyan = QColor.fromRgb( 6, 152, 154 ) # #06989a
ttyGrey = QColor.fromRgb( 211, 215, 207 ) # #d3d7cf
ttyLightBlack = QColor.fromRgb( 85, 87, 83 ) # #555753
ttyLightRed = QColor.fromRgb( 239, 41, 41 ) # #ef2929
ttyLightGreen = QColor.fromRgb( 138, 226, 52 ) # #8ae234
ttyLightYellow = QColor.fromRgb( 252, 233, 79 ) # #fce94f
ttyLightBlue = QColor.fromRgb( 114, 159, 207 ) # #729fcf
ttyLightViolet = QColor.fromRgb( 173, 127, 168 ) # #ad7fa8
ttyLightCyan = QColor.fromRgb( 52, 226, 226 ) # #34e2e2
ttyLightGrey = QColor.fromRgb( 238, 238, 236 ) # #eeeeec
Rules = [ [ttyLightViolet, Bold , re.compile(r'^Scanning.*'), None]
, [ttyLightRed , Bold , re.compile(r'^Linking.*'), None]
, [ttyLightGreen , Normal , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Building.*)'), None]
, [ttyLightGreen , Bold , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Built target.*)'), None]
, [ttyLightBlue , Normal , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Generating.*moc_.*)'), None]
, [ttyLightBlue , Bold , re.compile(r'^Generating.*'), None]
, [ttyLightCyan , Normal , re.compile(r'^Install the project.*'), None]
, [ttyCyan , Bold , re.compile(r'^-- Install.*'), None]
, [ttyCyan , Bold|Italic, re.compile(r'^-- Up-to-date.*'), None]
]
def __init__ ( self, parent=None ):
QSyntaxHighlighter.__init__ ( self, parent )
for rule in Highlighter.Rules:
if not rule[3]:
rule[3] = QTextCharFormat()
rule[3].setForeground( rule[0] )
if rule[1] & Highlighter.Normal: rule[3].setFontWeight( QFont.Normal )
if rule[1] & Highlighter.Bold: rule[3].setFontWeight( QFont.Bold )
if rule[1] & Highlighter.Italic: rule[3].setFontItalic( True )
return
def highlightBlock ( self, line ):
for rule in Highlighter.Rules:
m = rule[2].match(line)
if m:
if 'percent' in m.groupdict():
self.setFormat( 7, len(line), rule[3] )
else:
self.setFormat( 0, len(line), rule[3] )
return

View File

@ -2,14 +2,14 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/OptionsWidget.py" |
# +-----------------------------------------------------------------+
@ -17,176 +17,163 @@
import re
import subprocess
from PyQt4.QtCore import Qt
from PyQt4.QtCore import pyqtSignal
from PyQt4.QtCore import QSettings
from PyQt4.QtGui import QColor
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QCheckBox
from PyQt4.QtGui import QGroupBox
from PyQt4.QtGui import QButtonGroup
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QGridLayout
from PyQt4.QtGui import QScrollArea
from PyQt4.QtGui import QComboBox
from builder.Project import Project
from builder.ConfigureWidget import ConfigureWidget
from builder.ProjectWidgets import ProjectWidgets
from PyQt4.QtCore import Qt, pyqtSignal, QSettings
from PyQt4.QtGui import QColor, QWidget, QPushButton, \
QCheckBox, QGroupBox, QButtonGroup, \
QVBoxLayout, QHBoxLayout, QGridLayout, \
QScrollArea, QComboBox
from .Project import Project
from .ConfigureWidget import ConfigureWidget
from .ProjectWidgets import ProjectWidgets
class OptionsWidget ( QWidget ):
progress = pyqtSignal(int)
def __init__ ( self, conf, parent=None ):
QWidget.__init__ ( self, parent )
self._conf = conf
self._projects = []
for project in self._conf.projects:
self._projects += [ ProjectWidgets(project) ]
progress = pyqtSignal(int)
def __init__ ( self, conf, parent=None ):
QWidget.__init__ ( self, parent )
self._conf = conf
self._projects = []
for project in self._conf.projects:
self._projects += [ ProjectWidgets(project) ]
gLayout = QGridLayout()
column = 0
for iproject in range(len(self._projects)):
column += self._projects[iproject].addToLayout( column, gLayout )
toolsGroup = QGroupBox( 'Projects && Tools' )
toolsGroup.setLayout( gLayout )
gLayout = QGridLayout()
column = 0
for iproject in range(len(self._projects)):
column += self._projects[iproject].addToLayout( column, gLayout )
toolsGroup = QGroupBox( 'Projects && Tools' )
toolsGroup.setLayout( gLayout )
scrollToolsGroup = QScrollArea()
scrollToolsGroup.setMinimumHeight( 350 )
#scrollToolsGroup.setVerticalScrollBarPolicy( Qt.ScrollBarAlwaysOn )
scrollToolsGroup.setWidget( toolsGroup )
self._buildMode = QComboBox()
self._buildMode.addItems( ('Release', 'Debug') )
#self._svnUpdate = QCheckBox( 'SVN Update' )
#self._svnStatus = QCheckBox( 'SVN Status' )
self._make = QCheckBox( 'Build' )
self._enableDoc = QCheckBox( 'Build Documentation' )
self._devtoolset = QCheckBox( 'Build with devtoolset 8' )
self._qt5 = QCheckBox( 'Build with Qt 5 (Qt 4 default)' )
self._noCache = QCheckBox( 'Remove previous CMake cache' )
self._rmBuild = QCheckBox( 'Cleanup Build Directory' )
self._verbose = QCheckBox( 'Display Compiler Commands' )
self._threads = QComboBox()
for j in range(16):
self._threads.addItem( '-j%d'%(j+1), j+1 )
self._commandGroup = QButtonGroup()
self._commandGroup.setExclusive( True )
#self._commandGroup.addButton( self._svnUpdate )
#self._commandGroup.addButton( self._svnStatus )
self._commandGroup.addButton( self._make )
vLayout = QVBoxLayout()
#vLayout.addWidget( self._svnUpdate )
#vLayout.addWidget( self._svnStatus )
vLayout.addWidget( self._make )
vLayout.addStretch()
commandGroup = QGroupBox( 'Command' )
commandGroup.setLayout( vLayout )
vLayout = QVBoxLayout()
vLayout.addWidget( self._buildMode )
vLayout.addWidget( self._enableDoc )
vLayout.addWidget( self._devtoolset )
vLayout.addWidget( self._qt5 )
vLayout.addWidget( self._noCache )
vLayout.addWidget( self._rmBuild )
vLayout.addStretch()
optionsGroup = QGroupBox( 'Command Options' )
optionsGroup.setLayout( vLayout )
vLayout = QVBoxLayout()
vLayout.addWidget( self._threads )
vLayout.addWidget( self._verbose )
vLayout.addStretch()
miscGroup = QGroupBox( 'Misc. Options' )
miscGroup.setLayout( vLayout )
hLayout = QHBoxLayout()
hLayout.addWidget( commandGroup )
hLayout.addWidget( optionsGroup )
hLayout.addWidget( miscGroup )
commands = QWidget()
commands.setLayout( hLayout )
vLayout = QVBoxLayout()
vLayout.addWidget( commands )
vLayout.addWidget( scrollToolsGroup )
vLayout.addStretch()
self.setLayout( vLayout )
self.readSettings()
return
def _getProjects ( self ): return self._projects
def _getBuildMode ( self ): return self._buildMode.currentText()
def _getThreads ( self ): return self._threads.currentText()
#def _getSvnUpdate ( self ): return self._svnUpdate.isChecked()
#def _getSvnStatus ( self ): return self._svnStatus.isChecked()
def _getMake ( self ): return self._make.isChecked()
def _getEnableDoc ( self ): return self._enableDoc.isChecked()
def _getDevtoolset ( self ): return self._devtoolset.isChecked()
def _getQt5 ( self ): return self._qt5.isChecked()
def _getNoCache ( self ): return self._noCache.isChecked()
def _getRmBuild ( self ): return self._rmBuild.isChecked()
def _getVerbose ( self ): return self._verbose.isChecked()
projects = property( _getProjects )
buildMode = property( _getBuildMode )
threads = property( _getThreads )
#svnUpdate = property( _getSvnUpdate )
#svnStatus = property( _getSvnStatus )
make = property( _getMake )
enableDoc = property( _getEnableDoc )
devtoolset = property( _getDevtoolset )
qt5 = property( _getQt5 )
noCache = property( _getNoCache )
rmBuild = property( _getRmBuild )
verbose = property( _getVerbose )
def readSettings ( self ):
settings = QSettings()
#self._svnUpdate .setChecked( settings.value('builder/svnUpdate').toBool() )
#self._svnStatus .setChecked( settings.value('builder/svnStatus').toBool() )
self._make .setChecked( settings.value('builder/make' ).toBool() )
self._enableDoc .setChecked( settings.value('builder/enableDoc').toBool() )
self._devtoolset .setChecked( settings.value('builder/devtoolset').toBool() )
self._qt5 .setChecked( settings.value('builder/qt5').toBool() )
self._noCache .setChecked( settings.value('builder/noCache' ).toBool() )
self._rmBuild .setChecked( settings.value('builder/rmBuild' ).toBool() )
self._verbose .setChecked( settings.value('builder/verbose' ).toBool() )
buildModeName = settings.value('builder/buildMode').toString()
index = self._buildMode.findText( buildModeName )
if index >= 0: self._buildMode.setCurrentIndex( index )
threads = settings.value('builder/threads').toString()
index = self._threads.findText( threads )
if index >= 0: self._threads.setCurrentIndex( index )
for project in self._projects: project.readFromSettings()
return
def saveSettings ( self ):
settings = QSettings()
#settings.setValue('builder/svnUpdate' , self._svnUpdate .isChecked() )
#settings.setValue('builder/svnStatus' , self._svnStatus .isChecked() )
settings.setValue('builder/make' , self._make .isChecked() )
settings.setValue('builder/enableDoc' , self._enableDoc .isChecked() )
settings.setValue('builder/devtoolset', self._devtoolset.isChecked() )
settings.setValue('builder/qt5' , self._qt5 .isChecked() )
settings.setValue('builder/buildMode' , self._buildMode .currentText() )
settings.setValue('builder/noCache' , self._noCache .isChecked() )
settings.setValue('builder/rmBuild' , self._rmBuild .isChecked() )
settings.setValue('builder/verbose' , self._verbose .isChecked() )
settings.setValue('builder/threads' , self._threads .currentText() )
for project in self._projects: project.saveToSettings()
return
scrollToolsGroup = QScrollArea()
scrollToolsGroup.setMinimumHeight( 350 )
#scrollToolsGroup.setVerticalScrollBarPolicy( Qt.ScrollBarAlwaysOn )
scrollToolsGroup.setWidget( toolsGroup )
self._buildMode = QComboBox()
self._buildMode.addItems( ('Release', 'Debug') )
#self._svnUpdate = QCheckBox( 'SVN Update' )
#self._svnStatus = QCheckBox( 'SVN Status' )
self._make = QCheckBox( 'Build' )
self._enableDoc = QCheckBox( 'Build Documentation' )
self._devtoolset = QCheckBox( 'Build with devtoolset 8' )
self._qt5 = QCheckBox( 'Build with Qt 5 (Qt 4 default)' )
self._noCache = QCheckBox( 'Remove previous CMake cache' )
self._rmBuild = QCheckBox( 'Cleanup Build Directory' )
self._verbose = QCheckBox( 'Display Compiler Commands' )
self._threads = QComboBox()
for j in range(16):
self._threads.addItem( '-j%d'%(j+1), j+1 )
self._commandGroup = QButtonGroup()
self._commandGroup.setExclusive( True )
#self._commandGroup.addButton( self._svnUpdate )
#self._commandGroup.addButton( self._svnStatus )
self._commandGroup.addButton( self._make )
vLayout = QVBoxLayout()
#vLayout.addWidget( self._svnUpdate )
#vLayout.addWidget( self._svnStatus )
vLayout.addWidget( self._make )
vLayout.addStretch()
commandGroup = QGroupBox( 'Command' )
commandGroup.setLayout( vLayout )
vLayout = QVBoxLayout()
vLayout.addWidget( self._buildMode )
vLayout.addWidget( self._enableDoc )
vLayout.addWidget( self._devtoolset )
vLayout.addWidget( self._qt5 )
vLayout.addWidget( self._noCache )
vLayout.addWidget( self._rmBuild )
vLayout.addStretch()
optionsGroup = QGroupBox( 'Command Options' )
optionsGroup.setLayout( vLayout )
vLayout = QVBoxLayout()
vLayout.addWidget( self._threads )
vLayout.addWidget( self._verbose )
vLayout.addStretch()
miscGroup = QGroupBox( 'Misc. Options' )
miscGroup.setLayout( vLayout )
hLayout = QHBoxLayout()
hLayout.addWidget( commandGroup )
hLayout.addWidget( optionsGroup )
hLayout.addWidget( miscGroup )
commands = QWidget()
commands.setLayout( hLayout )
vLayout = QVBoxLayout()
vLayout.addWidget( commands )
vLayout.addWidget( scrollToolsGroup )
vLayout.addStretch()
self.setLayout( vLayout )
self.readSettings()
return
def _getProjects ( self ): return self._projects
def _getBuildMode ( self ): return self._buildMode.currentText()
def _getThreads ( self ): return self._threads.currentText()
#def _getSvnUpdate ( self ): return self._svnUpdate.isChecked()
#def _getSvnStatus ( self ): return self._svnStatus.isChecked()
def _getMake ( self ): return self._make.isChecked()
def _getEnableDoc ( self ): return self._enableDoc.isChecked()
def _getDevtoolset ( self ): return self._devtoolset.isChecked()
def _getQt5 ( self ): return self._qt5.isChecked()
def _getNoCache ( self ): return self._noCache.isChecked()
def _getRmBuild ( self ): return self._rmBuild.isChecked()
def _getVerbose ( self ): return self._verbose.isChecked()
projects = property( _getProjects )
buildMode = property( _getBuildMode )
threads = property( _getThreads )
#svnUpdate = property( _getSvnUpdate )
#svnStatus = property( _getSvnStatus )
make = property( _getMake )
enableDoc = property( _getEnableDoc )
devtoolset = property( _getDevtoolset )
qt5 = property( _getQt5 )
noCache = property( _getNoCache )
rmBuild = property( _getRmBuild )
verbose = property( _getVerbose )
def readSettings ( self ):
settings = QSettings()
#self._svnUpdate .setChecked( bool(settings.value('builder/svnUpdate' )) )
#self._svnStatus .setChecked( bool(settings.value('builder/svnStatus' )) )
self._make .setChecked( bool(settings.value('builder/make' )) )
self._enableDoc .setChecked( bool(settings.value('builder/enableDoc' )) )
self._devtoolset .setChecked( bool(settings.value('builder/devtoolset')) )
self._qt5 .setChecked( bool(settings.value('builder/qt5' )) )
self._noCache .setChecked( bool(settings.value('builder/noCache' )) )
self._rmBuild .setChecked( bool(settings.value('builder/rmBuild' )) )
self._verbose .setChecked( bool(settings.value('builder/verbose' )) )
buildModeName = settings.value('builder/buildMode')
index = self._buildMode.findText( buildModeName )
if index >= 0: self._buildMode.setCurrentIndex( index )
threads = settings.value('builder/threads')
index = self._threads.findText( threads )
if index >= 0: self._threads.setCurrentIndex( index )
for project in self._projects: project.readFromSettings()
return
def saveSettings ( self ):
settings = QSettings()
#settings.setValue('builder/svnUpdate' , self._svnUpdate .isChecked() )
#settings.setValue('builder/svnStatus' , self._svnStatus .isChecked() )
settings.setValue('builder/make' , self._make .isChecked() )
settings.setValue('builder/enableDoc' , self._enableDoc .isChecked() )
settings.setValue('builder/devtoolset', self._devtoolset.isChecked() )
settings.setValue('builder/qt5' , self._qt5 .isChecked() )
settings.setValue('builder/buildMode' , self._buildMode .currentText() )
settings.setValue('builder/noCache' , self._noCache .isChecked() )
settings.setValue('builder/rmBuild' , self._rmBuild .isChecked() )
settings.setValue('builder/verbose' , self._verbose .isChecked() )
settings.setValue('builder/threads' , self._threads .currentText() )
for project in self._projects: project.saveToSettings()
return

View File

@ -2,14 +2,14 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/Project.py" |
# +-----------------------------------------------------------------+

View File

@ -2,93 +2,83 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/ProjectWidget.py" |
# +-----------------------------------------------------------------+
import string
from PyQt4.QtCore import Qt
from PyQt4.QtCore import QObject
from PyQt4.QtCore import QSettings
from PyQt4.QtGui import QSizePolicy
from PyQt4.QtGui import QFrame
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QCheckBox
from PyQt4.QtGui import QLabel
from PyQt4.QtCore import Qt, QObject, QSettings
from PyQt4.QtGui import QSizePolicy, QFrame, QPushButton, QCheckBox, \
QLabel
class ProjectWidgets ( QObject ):
def __init__ ( self, project ):
self._project = project
self._projectButton = QLabel( string.capwords(self._project.getName()) )
self._projectButton.setStyleSheet( 'font-weight: bold;' )
self._projectButton.setFrameShape( QFrame.Box )
self._projectButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred )
self._toolsCheckBoxes = []
for tool in self._project.getTools():
self._toolsCheckBoxes += [ QCheckBox( tool.name ) ]
#self._projectButton.clicked.connect( self.toggleToolsVisibility )
return
def _getProjectButton ( self ): return self._projectButton
def _getToolsCheckBoxes ( self ): return self._toolsCheckBoxes
def _getActives ( self ):
actives = []
for toolCb in self._toolsCheckBoxes:
if toolCb.isChecked(): actives += [ str(toolCb.text()) ]
return actives
projectButton = property( _getProjectButton )
toolsCheckBoxes = property( _getToolsCheckBoxes )
actives = property( _getActives )
def addToLayout( self, column, layout ):
toolsNb = len(self._toolsCheckBoxes)
if toolsNb <= 10:
layout.addWidget( self._projectButton, 0, column, Qt.AlignLeft )
for row in range(toolsNb):
layout.addWidget( self._toolsCheckBoxes[row], row+1, column, Qt.AlignTop )
return 1
columnSpan = toolsNb / 10
if toolsNb % 10: columnSpan += 1
layout.addWidget( self._projectButton, 0, column, 1, columnSpan, Qt.AlignJustify )
for row in range(toolsNb):
if row and row % 10 == 0: column += 1
layout.addWidget( self._toolsCheckBoxes[row], row%10+1, column, Qt.AlignTop )
return columnSpan
#def toggleToolsVisibility ( self ):
# self._visibleTools = not self._visibleTools
# for toolCb in self._toolsCheckBoxes:
# toolCb.setVisible( self._visibleTools )
# return
def readFromSettings ( self ):
settings = QSettings()
for toolCb in self._toolsCheckBoxes:
toolId = 'tools/'+self._project.getName()+'/'+toolCb.text()
toolCb.setChecked( settings.value(toolId).toBool() )
return
def saveToSettings ( self ):
settings = QSettings()
for toolCb in self._toolsCheckBoxes:
toolId = 'tools/'+self._project.getName()+'/'+toolCb.text()
settings.setValue( toolId, toolCb.isChecked() )
return
def __init__ ( self, project ):
self._project = project
self._projectButton = QLabel( string.capwords(self._project.getName()) )
self._projectButton.setStyleSheet( 'font-weight: bold;' )
self._projectButton.setFrameShape( QFrame.Box )
self._projectButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred )
self._toolsCheckBoxes = []
for tool in self._project.getTools():
self._toolsCheckBoxes += [ QCheckBox( tool.name ) ]
#self._projectButton.clicked.connect( self.toggleToolsVisibility )
return
def _getProjectButton ( self ): return self._projectButton
def _getToolsCheckBoxes ( self ): return self._toolsCheckBoxes
def _getActives ( self ):
actives = []
for toolCb in self._toolsCheckBoxes:
if toolCb.isChecked(): actives += [ str(toolCb.text()) ]
return actives
projectButton = property( _getProjectButton )
toolsCheckBoxes = property( _getToolsCheckBoxes )
actives = property( _getActives )
def addToLayout( self, column, layout ):
toolsNb = len(self._toolsCheckBoxes)
if toolsNb <= 10:
layout.addWidget( self._projectButton, 0, column, Qt.AlignLeft )
for row in range(toolsNb):
layout.addWidget( self._toolsCheckBoxes[row], row+1, column, Qt.AlignTop )
return 1
columnSpan = toolsNb / 10
if toolsNb % 10: columnSpan += 1
layout.addWidget( self._projectButton, 0, column, 1, columnSpan, Qt.AlignJustify )
for row in range(toolsNb):
if row and row % 10 == 0: column += 1
layout.addWidget( self._toolsCheckBoxes[row], row%10+1, column, Qt.AlignTop )
return columnSpan
#def toggleToolsVisibility ( self ):
# self._visibleTools = not self._visibleTools
# for toolCb in self._toolsCheckBoxes:
# toolCb.setVisible( self._visibleTools )
# return
def readFromSettings ( self ):
settings = QSettings()
for toolCb in self._toolsCheckBoxes:
toolId = 'tools/'+self._project.getName()+'/'+toolCb.text()
toolCb.setChecked( bool(settings.value(toolId)) )
return
def saveToSettings ( self ):
settings = QSettings()
for toolCb in self._toolsCheckBoxes:
toolId = 'tools/'+self._project.getName()+'/'+toolCb.text()
settings.setValue( toolId, toolCb.isChecked() )
return

View File

@ -2,14 +2,14 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./builder/__init__.py" |
# +-----------------------------------------------------------------+
@ -21,8 +21,7 @@ class ErrorMessage ( Exception ):
def __init__ ( self, code, *arguments ):
self._code = code
self._errors = [ 'Malformed call to ErrorMessage()'
, '%s' % str(arguments) ]
self._errors = [ 'Malformed call to ErrorMessage()', '{}'.format(arguments) ]
text = None
if len(arguments) == 1:
@ -31,7 +30,6 @@ class ErrorMessage ( Exception ):
self._errors = arguments[0]
elif len(arguments) > 1:
text = list(arguments)
if text:
self._errors = []
while len(text[0]) == 0: del text[0]
@ -50,11 +48,10 @@ class ErrorMessage ( Exception ):
def __str__ ( self ):
if not isinstance(self._errors,list):
return "[ERROR] %s" % self._errors
formatted = "\n"
for i in range(len(self._errors)):
if i == 0: formatted += "[ERROR] %s" % self._errors[i]
else: formatted += " %s" % self._errors[i]
if i == 0: formatted += "[ERROR] {}".format(self._errors[i] )
else: formatted += " {}".format(self._errors[i] )
if i+1 < len(self._errors): formatted += "\n"
return formatted
@ -69,7 +66,7 @@ class ErrorMessage ( Exception ):
return
def terminate ( self ):
print self
print( self )
sys.exit(self._code)
def _getCode ( self ): return self._code

View File

@ -1,17 +1,17 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2008-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s / C h a m s B u i l d e r |
# | T o o l c h a i n B u i l d e r |
# | |
# | Authors : Jean-Paul Chaput |
# | Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./ccb.py" |
# +-----------------------------------------------------------------+
@ -19,37 +19,36 @@
showTrace = True
try:
import sys
import os.path
import optparse
import traceback
import distutils.sysconfig
import subprocess
import re
except ImportError, e:
module = str(e).split()[-1]
print '[ERROR] The <%s> python module or symbol cannot be loaded.' % module
print ' Please check your standard Python installation, it may have problems.'
quit()
import sys
import os.path
import optparse
import traceback
import distutils.sysconfig
import subprocess
import re
except ImportError as e:
module = str(e).split()[-1]
print( '[ERROR] The "{}" python module or symbol cannot be loaded.'.format(module) )
print( ' Please check your standard Python installation, it may have problems.' )
quit()
def safeImport ( moduleName, symbol=None ):
try:
module = __import__( moduleName, globals(), locals(), symbol )
except ImportError, e:
print '[ERROR] The <%s> python module or symbol cannot be loaded.' % moduleName
print ' Please check the integrity of the <coriolis/boostrap> package.'
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(1)
except Exception, e:
print '[ERROR] An exception occured while importing module <%s>. Is is a bug,' % moduleName
print ' you may want to report it...'
print ' %s' % e
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2)
if symbol: return module.__dict__[symbol]
return module
try:
module = __import__( moduleName, globals(), locals(), symbol )
except ImportError as e:
print( '[ERROR] The "{}" python module or symbol cannot be loaded.'.format(moduleName) )
print( ' Please check the integrity of the "coriolis/boostrap" package.' )
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(1)
except Exception as e:
print( '[ERROR] An exception occured while importing module "{}". Is is a bug,'.format(moduleName) )
print( ' you may want to report it...' )
print( ' {}'.format(e) )
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2)
if symbol: return module.__dict__[symbol]
return module
def checkCMake ():
@ -57,8 +56,8 @@ def checkCMake ():
(pid,status) = os.waitpid ( child.pid, 0 )
status >>= 8
if status != 0:
print '[ERROR] The <cmake> program has not been found, please install it.'
sys.exit(1)
print( '[ERROR] The "cmake" program has not been found, please install it.' )
sys.exit(1)
def guessOs ():
@ -85,62 +84,60 @@ def guessOs ():
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines()
if osSlsoc7x_64.match(lines[0]):
line = lines[0].decode( 'ascii' )
if osSlsoc7x_64.match(line):
osType = "Linux.el7_64"
libDir = "lib64"
elif osSlsoc6x_64.match(lines[0]):
elif osSlsoc6x_64.match(line):
osType = "Linux.slsoc6x_64"
libDir = "lib64"
elif osSlsoc6x.match(lines[0]):
elif osSlsoc6x.match(line):
osType = "Linux.slsoc6x"
elif osSLSoC5x_64.match(lines[0]):
elif osSLSoC5x_64.match(line):
osType = "Linux.SLSoC5x_64"
libDir = "lib64"
elif osSLSoC5x .match(lines[0]):
elif osSLSoC5x .match(line):
osType = "Linux.SLSoC5x"
elif osFedora_64.match(lines[0]):
elif osFedora_64.match(line):
osType = "Linux.fc_64"
libDir = "lib64"
elif osFedora .match(lines[0]):
elif osFedora .match(line):
osType = "Linux.fc"
elif osLinux_64.match(lines[0]):
elif osLinux_64.match(line):
osType = "Linux.x86_64"
libDir = "lib64"
elif osLinux .match(lines[0]):
elif osLinux .match(line):
osType = "Linux.i386"
elif osDarwin.match(lines[0]):
elif osDarwin.match(line):
osType = "Darwin"
elif osFreeBSD8x_amd64.match(lines[0]):
elif osFreeBSD8x_amd64.match(line):
osType = "FreeBSD.8x.amd64"
libDir = "lib64"
elif osFreeBSD8x_64.match(lines[0]):
elif osFreeBSD8x_64.match(line):
osType = "FreeBSD.8x.x86_64"
libDir = "lib64"
elif osFreeBSD8x.match(lines[0]):
elif osFreeBSD8x.match(line):
osType = "FreeBSD.8x.i386"
elif osCygwinW7_64.match(lines[0]):
elif osCygwinW7_64.match(line):
osType = "Cygwin.W7_64"
libDir = "lib64"
elif osCygwinW7.match(lines[0]):
elif osCygwinW7.match(line):
osType = "Cygwin.W7"
elif osCygwinW8_64.match(lines[0]):
elif osCygwinW8_64.match(line):
osType = "Cygwin.W8_64"
libDir = "lib64"
elif osCygwinW8.match(lines[0]):
elif osCygwinW8.match(line):
osType = "Cygwin.W8"
elif osCygwinW10_64.match(lines[0]):
elif osCygwinW10_64.match(line):
osType = "Cygwin.W10_64"
libDir = "lib64"
elif osCygwinW10.match(lines[0]):
elif osCygwinW10.match(line):
osType = "Cygwin.W10"
else:
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: "{}".'.format(lines[0][:-1]) )
print( ' (using: "{}")'.format(osType) )
return osType, libDir
@ -151,10 +148,9 @@ def guessPythonSitePackage ():
def autoLocate ():
osType, libDir = guessOs()
print 'Building for target: <%s>' % osType
print 'Making an educated guess to locate myself:'
sitePackage = guessPythonSitePackage()
print( 'Building for target: "{}"'.format(osType) )
print( 'Making an educated guess to locate myself:' )
sitePackage = guessPythonSitePackage()
builderDir = None
locations = [ os.path.abspath(os.path.dirname(sys.argv[0]))
, os.environ['HOME']+'/coriolis-2.x/src/coriolis/bootstrap'
@ -163,26 +159,22 @@ def autoLocate ():
, os.environ['HOME']+'/coriolis-2.x/'+osType+'/Release.Shared/install/'+libDir+'/'+sitePackage
, '/users/outil/coriolis/coriolis-2.x/'+osType+'/Release.Shared/install/'+libDir+'/'+sitePackage
]
for location in locations:
print ' <%s>' % location,
print( ' "{}" '.format(location), end='' )
if os.path.isfile(location + '/builder/__init__.py'):
if not builderDir:
builderDir = location
print '(Found*)'
print( '(Found*)' )
else:
print '(Found)'
print( '(Found)' )
else:
print '(No)'
print( '(No)' )
if not builderDir:
print '[ERROR] Failed to locate the builder modules in any of the normal pathes.'
print ' Please check your Coriolis/Bootsrap installation.'
print( '[ERROR] Failed to locate the builder modules in any of the normal pathes.' )
print( ' Please check your Coriolis/Bootsrap installation.' )
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(1)
sys.path.insert( 0, builderDir )
return
@ -193,125 +185,117 @@ autoLocate()
checkCMake()
parser = optparse.OptionParser ()
parser.add_option ( "-g", "--gui" , action="store_true" , dest="gui" , help="Lauch the graphical interface." )
# Build relateds.
parser.add_option ( "-c", "--conf" , type="string", dest="conf" , help="Fichier de configuration." )
parser.add_option ( "--show-conf" , action="store_true" , dest="showConf" , help="Display the Project/Tools configuration, then exit." )
parser.add_option ( "-q", "--quiet" , action="store_true" , dest="quiet" , help="Do not print all the informative messages." )
parser.add_option ( "-r", "--release" , action="store_true" , dest="release" , help="Build a <Release> aka optimized version." )
parser.add_option ( "-d", "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." )
parser.add_option ( "-s", "--static" , action="store_true" , dest="static" , help="Try to link statically, as much as possible." )
parser.add_option ( "--doc" , action="store_true" , dest="doc" , help="Enable the documentation building (uses with -j1)." )
parser.add_option ( "-v", "--verbose" , action="store_true" , dest="verboseMakefile" , help="Tells CMake to print all compilation commands." )
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" , help="The root directory (default: <~/coriolis-2.x/>)." )
parser.add_option ( "--no-build" , action="store_true" , dest="noBuild" , help="Do *not* build anything (by default: build)." )
parser.add_option ( "--no-cache" , action="store_true" , dest="noCache" , help="Remove previous CMake cache before building." )
parser.add_option ( "--rm-build" , action="store_true" , dest="rmBuild" , help="Remove previous build directoty before building." )
parser.add_option ( "--macports" , action="store_true" , dest="macports" , help="Build against MacPorts." )
parser.add_option ( "--devtoolset" , action="store" , type="int" , dest="devtoolset" , help="Build against TUV Dev Toolset N." )
parser.add_option ( "--llvm-toolset" , action="store" , type="int" , dest="llvmtoolset" , help="Build against TUV Dev LLVM Toolset N." )
parser.add_option ( "--qt5" , action="store_true" , dest="qt5" , help="Build against Qt 5 (default: Qt 4)." )
parser.add_option ( "--bfd" , action="store_true" , dest="bfd" , help="Build against Qt 5 (default: Qt 4)." )
parser.add_option ( "--openmp" , action="store_true" , dest="openmp" , help="Enable the use of OpenMP in Gcc." )
parser.add_option ( "--ninja" , action="store_true" , dest="ninja" , help="Use Ninja instead of UNIX Makefile." )
parser.add_option ( "--clang" , action="store_true" , dest="clang" , help="Force use of Clang C/C++ compiler instead of system default." )
parser.add_option ( "--make" , action="store" , type="string", dest="makeArguments", help="Arguments to pass to make (ex: \"-j4 install\")." )
parser.add_option ( "--project" , action="append" , type="string", dest="projects" , help="The name of a project to build (may appears any number of time)." )
parser.add_option ( "-t", "--tool" , action="append" , type="string", dest="tools" , help="The name of a tool to build (may appears any number of time)." )
parser.add_option ( "-g", "--gui" , action="store_true" , dest="gui" , help="Lauch the graphical interface." )
# Build relateds.
parser.add_option ( "-c", "--conf" , type="string", dest="conf" , help="Fichier de configuration." )
parser.add_option ( "--show-conf" , action="store_true" , dest="showConf" , help="Display the Project/Tools configuration, then exit." )
parser.add_option ( "-q", "--quiet" , action="store_true" , dest="quiet" , help="Do not print all the informative messages." )
parser.add_option ( "-r", "--release" , action="store_true" , dest="release" , help="Build a <Release> aka optimized version." )
parser.add_option ( "-d", "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." )
parser.add_option ( "-s", "--static" , action="store_true" , dest="static" , help="Try to link statically, as much as possible." )
parser.add_option ( "--doc" , action="store_true" , dest="doc" , help="Enable the documentation building (uses with -j1)." )
parser.add_option ( "-v", "--verbose" , action="store_true" , dest="verboseMakefile", help="Tells CMake to print all compilation commands." )
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" , help="The root directory (default: <~/coriolis-2.x/>)." )
parser.add_option ( "--no-build" , action="store_true" , dest="noBuild" , help="Do *not* build anything (by default: build)." )
parser.add_option ( "--no-cache" , action="store_true" , dest="noCache" , help="Remove previous CMake cache before building." )
parser.add_option ( "--rm-build" , action="store_true" , dest="rmBuild" , help="Remove previous build directoty before building." )
parser.add_option ( "--macports" , action="store_true" , dest="macports" , help="Build against MacPorts." )
parser.add_option ( "--devtoolset" , action="store" , type="int" , dest="devtoolset" , help="Build against TUV Dev Toolset N." )
parser.add_option ( "--llvm-toolset" , action="store" , type="int" , dest="llvmtoolset" , help="Build against TUV Dev LLVM Toolset N." )
parser.add_option ( "--qt5" , action="store_true" , dest="qt5" , help="Build against Qt 5 (default: Qt 4)." )
parser.add_option ( "--bfd" , action="store_true" , dest="bfd" , help="Build against Qt 5 (default: Qt 4)." )
parser.add_option ( "--openmp" , action="store_true" , dest="openmp" , help="Enable the use of OpenMP in Gcc." )
parser.add_option ( "--ninja" , action="store_true" , dest="ninja" , help="Use Ninja instead of UNIX Makefile." )
parser.add_option ( "--clang" , action="store_true" , dest="clang" , help="Force use of Clang C/C++ compiler instead of system default." )
parser.add_option ( "--make" , action="store" , type="string", dest="makeArguments" , help="Arguments to pass to make (ex: \"-j4 install\")." )
parser.add_option ( "--project" , action="append" , type="string", dest="projects" , help="The name of a project to build (may appears any number of time)." )
parser.add_option ( "-t", "--tool" , action="append" , type="string", dest="tools" , help="The name of a tool to build (may appears any number of time)." )
# SVN repository relateds.
# Have to be ported to Git.
#parser.add_option ( "--svn-tag" , action="store" , type="string", dest="svnTag" , help="Explicitly select a SVN tag (for SVN related commands)." )
#parser.add_option ( "--svn-method" , action="store" , type="string", dest="svnMethod" , help="Allows to sets the svn checkout method (svn+ssh://coriolis.soc.lip6.fr)." )
#parser.add_option ( "--svn-status" , action="store_true" , dest="svnStatus" , help="Check status against the SVN repository." )
#parser.add_option ( "--svn-diff" , action="store_true" , dest="svnDiff" , help="Perform a diff against the SVN repository." )
#parser.add_option ( "--svn-update" , action="store_true" , dest="svnUpdate" , help="Update to the latest SVN version *or* the one given by svn-tag." )
#parser.add_option ( "--svn-checkout" , action="store_true" , dest="svnCheckout" , help="Checkout the latest SVN version *or* the one given by svn-tag." )
#parser.add_option ( "--svn-tag" , action="store" , type="string", dest="svnTag" , help="Explicitly select a SVN tag (for SVN related commands)." )
#parser.add_option ( "--svn-method" , action="store" , type="string", dest="svnMethod" , help="Allows to sets the svn checkout method (svn+ssh://coriolis.soc.lip6.fr)." )
#parser.add_option ( "--svn-status" , action="store_true" , dest="svnStatus" , help="Check status against the SVN repository." )
#parser.add_option ( "--svn-diff" , action="store_true" , dest="svnDiff" , help="Perform a diff against the SVN repository." )
#parser.add_option ( "--svn-update" , action="store_true" , dest="svnUpdate" , help="Update to the latest SVN version *or* the one given by svn-tag." )
#parser.add_option ( "--svn-checkout" , action="store_true" , dest="svnCheckout" , help="Checkout the latest SVN version *or* the one given by svn-tag." )
# Miscellaneous.
parser.add_option ( "--user-tarball" , action="store_true" , dest="userTarball" , help="Regenerate a tarball from checked out sources (in <root>/tarball/." )
parser.add_option ( "--tarball" , action="store_true" , dest="tarball" , help="Regenerate a tarball (in <root>/tarball/." )
parser.add_option ( "--rpm" , action="store_true" , dest="doRpm" , help="Regenerate RPM packages." )
parser.add_option ( "--deb" , action="store_true" , dest="doDeb" , help="Regenerate Debian/Ubuntu packages." )
# Katabatic/Kite specific options.
parser.add_option ( "-D", "--check-db" , action="store_true" , dest="checkDb" , help="Enable Katabatic/Kite data-base checking (*very* slow)." )
parser.add_option ( "-u", "--check-deter" , action="store_true" , dest="checkDeterminism", help="Enable Katabatic/Kite determinism checking (*very* slow)." )
parser.add_option ( "--user-tarball" , action="store_true" , dest="userTarball" , help="Regenerate a tarball from checked out sources (in <root>/tarball/." )
parser.add_option ( "--tarball" , action="store_true" , dest="tarball" , help="Regenerate a tarball (in <root>/tarball/." )
parser.add_option ( "--rpm" , action="store_true" , dest="doRpm" , help="Regenerate RPM packages." )
parser.add_option ( "--deb" , action="store_true" , dest="doDeb" , help="Regenerate Debian/Ubuntu packages." )
# Katabatic/Kite specific options.
parser.add_option ( "-D", "--check-db" , action="store_true" , dest="checkDb" , help="Enable Katabatic/Kite data-base checking (*very* slow)." )
parser.add_option ( "-u", "--check-deter" , action="store_true" , dest="checkDeterminism", help="Enable Katabatic/Kite determinism checking (*very* slow)." )
(options, args) = parser.parse_args ()
if options.gui:
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' )
QApplication = safeImport( 'PyQt4.QtGui' , 'QApplication' )
BuilderGui = safeImport( 'builder.BuilderGui', 'BuilderGui' )
try:
app = QApplication( sys.argv )
app.setOrganizationName ( 'UPMC' )
app.setOrganizationDomain( 'lip6.fr' )
app.setApplicationName ( 'CoriolisBuilder' )
gui = BuilderGui( options.conf )
gui.show()
rcode = app.exec_()
sys.exit( rcode )
except ErrorMessage, e:
print e
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2)
except Exception, e:
print '[ERROR] An exception occured while running the Qt application.'
print ' %s' % e
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2)
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' )
QApplication = safeImport( 'PyQt4.QtGui' , 'QApplication' )
BuilderGui = safeImport( 'builder.BuilderGui', 'BuilderGui' )
try:
app = QApplication( sys.argv )
app.setOrganizationName ( 'UPMC' )
app.setOrganizationDomain( 'lip6.fr' )
app.setApplicationName ( 'CoriolisBuilder' )
gui = BuilderGui( options.conf )
gui.show()
rcode = app.exec_()
sys.exit( rcode )
except ErrorMessage as e:
print( e )
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2)
except Exception as e:
print( '[ERROR] An exception occured while running the Qt application.' )
print( ' {}'.format(e) )
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2)
else:
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' )
Builder = safeImport( 'builder.Builder', 'Builder' )
try:
builder = Builder()
builder.loadConfiguration( options.conf )
if options.showConf:
builder.showConfiguration ()
sys.exit(0)
if options.quiet: builder.quiet = True
if options.release: builder.buildMode = "Release"
if options.debug: builder.buildMode = "Debug"
if options.static: builder.enableShared = "OFF"
if options.doc: builder.enableDoc = "ON"
if options.checkDb: builder.checkDatabase = "ON"
if options.checkDeterminism: builder.checkDeterminism = "ON"
if options.verboseMakefile: builder.verboseMakefile = "ON"
if options.rootDir: builder.rootDir = options.rootDir
if options.noBuild: builder.doBuild = False
if options.noCache: builder.noCache = True
if options.rmBuild: builder.rmBuild = True
if options.ninja: builder.ninja = True
if options.clang or options.llvmtoolset: builder.clang = True
if options.macports: builder.macports = True
if options.devtoolset: builder.devtoolset = options.devtoolset
if options.llvmtoolset: builder.llvmtoolset = options.llvmtoolset
if options.bfd: builder.bfd = "ON"
if options.qt5: builder.qt5 = True
if options.openmp: builder.openmp = True
if options.makeArguments: builder.makeArguments = options.makeArguments
#if options.svnMethod: builder.svnMethod = options.svnMethod
#if options.svnTag: builder.svnTag = options.svnTag
#if options.svnStatus: builder.svnStatus ( tools=options.tools, projects=options.projects )
#elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects )
#elif options.svnDiff: builder.svnDiff ( tools=options.tools, projects=options.projects )
#elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects )
if options.userTarball: builder.userTarball ( tools=options.tools, projects=options.projects )
elif options.tarball: builder.svnTarball ( tools=options.tools, projects=options.projects )
elif options.doRpm: builder.doRpm ()
elif options.doDeb: builder.doDeb ()
else: builder.build ( tools=options.tools, projects=options.projects )
except ErrorMessage, e:
print e
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(e.code)
except KeyboardInterrupt, e:
print '\n[ERROR] Interrupted by user\'s request (CTRL+C)'
sys.exit(1)
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' )
Builder = safeImport( 'builder.Builder', 'Builder' )
try:
builder = Builder()
builder.loadConfiguration( options.conf )
if options.showConf:
builder.showConfiguration ()
sys.exit(0)
if options.quiet: builder.quiet = True
if options.release: builder.buildMode = "Release"
if options.debug: builder.buildMode = "Debug"
if options.static: builder.enableShared = "OFF"
if options.doc: builder.enableDoc = "ON"
if options.checkDb: builder.checkDatabase = "ON"
if options.checkDeterminism: builder.checkDeterminism = "ON"
if options.verboseMakefile: builder.verboseMakefile = "ON"
if options.rootDir: builder.rootDir = options.rootDir
if options.noBuild: builder.doBuild = False
if options.noCache: builder.noCache = True
if options.rmBuild: builder.rmBuild = True
if options.ninja: builder.ninja = True
if options.clang or options.llvmtoolset: builder.clang = True
if options.macports: builder.macports = True
if options.devtoolset: builder.devtoolset = options.devtoolset
if options.llvmtoolset: builder.llvmtoolset = options.llvmtoolset
if options.bfd: builder.bfd = "ON"
if options.qt5: builder.qt5 = True
if options.openmp: builder.openmp = True
if options.makeArguments: builder.makeArguments = options.makeArguments
#if options.svnMethod: builder.svnMethod = options.svnMethod
#if options.svnTag: builder.svnTag = options.svnTag
#if options.svnStatus: builder.svnStatus ( tools=options.tools, projects=options.projects )
#elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects )
#elif options.svnDiff: builder.svnDiff ( tools=options.tools, projects=options.projects )
#elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects )
if options.userTarball: builder.userTarball ( tools=options.tools, projects=options.projects )
elif options.tarball: builder.svnTarball ( tools=options.tools, projects=options.projects )
elif options.doRpm: builder.doRpm ()
elif options.doDeb: builder.doDeb ()
else: builder.build ( tools=options.tools, projects=options.projects )
except ErrorMessage as e:
print( e )
if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(e.code)
except KeyboardInterrupt as e:
print( '\n[ERROR] Interrupted by user\'s request (CTRL+C)' )
sys.exit(1)
sys.exit(0)

View File

@ -94,12 +94,12 @@
set(ADDTIONAL_FLAGS "")
set(CXX_STANDARD "c++11")
endif()
set(CMAKE_C_FLAGS_DEBUG " -Wall -fsanitize=address ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)
#set(CMAKE_C_FLAGS_DEBUG " -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)
#set(CMAKE_C_FLAGS_DEBUG " -Wall -fsanitize=address ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)
set(CMAKE_C_FLAGS_DEBUG " -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE)
set(CMAKE_C_FLAGS_RELEASE " -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE)
#set(CMAKE_C_FLAGS_RELEASE " -Wall -fsanitize=address ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall -fsanitize=address ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE)
#set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE)
#set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall -fsanitize=address ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C++ Compiler Release options." FORCE)
#set(CMAKE_CXX_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -fsanitize=address ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C++ Compiler Release options." FORCE)
@ -418,8 +418,30 @@
)
target_link_libraries( ${pytarget} ${pyDeplibs} )
install( TARGETS ${pytarget} DESTINATION ${PYTHON_SITE_PACKAGES} )
install( TARGETS ${pytarget} DESTINATION ${Python_CORIOLISARCH} )
if( NOT ("${pyIncludes}" STREQUAL "None") )
install( FILES ${pyIncludes} DESTINATION ${inc_install_dir} )
endif()
endmacro( add_python_module )
#
# Build a Python extention module (3rd version).
# Usage:
# * pyCpps: The list of C/C++ module files.
# * pyIncludes: The list of C/C++ header files (will be installed in
# "inc_install_dir").
# * pymodule: The name of the Python module (for "import PYMODULE").
# * deplibs: The list of dependencies.
# * inc_install_dir: The directory into which install the includes.
#
macro( add_python_module3 pyCpps pyIncludes pymodule deplibs inc_install_dir )
add_library( ${pymodule} MODULE ${pyCpps} )
set_target_properties( ${pymodule} PROPERTIES PREFIX "" )
target_link_libraries( ${pymodule} ${deplibs} )
install( TARGETS ${pymodule} DESTINATION ${Python_CORIOLISARCH} )
if( NOT ("${pyIncludes}" STREQUAL "None") )
install( FILES ${pyIncludes} DESTINATION ${inc_install_dir} )
endif()
endmacro( add_python_module3 )

View File

@ -1,13 +1,26 @@
if(UNIX)
if(NOT Python_FOUND)
message(FATAL_ERROR "Python has not been found, maybe forgot to call find_package(Python). ")
endif()
# This way avoids newline in the script string.
set(SCRIPT "import os.path,distutils.sysconfig")
set(SCRIPT "${SCRIPT}; pathes = distutils.sysconfig.get_python_lib().split('/')")
set(SCRIPT "${SCRIPT}; print os.path.join(pathes[-2],pathes[-1])")
set(SCRIPT "${SCRIPT}; pathes = distutils.sysconfig.get_python_lib('platstdlib').split('/')")
set(SCRIPT "${SCRIPT}; print( os.path.join(pathes[-2],pathes[-1]) )")
execute_process(COMMAND "python" "-c" "${SCRIPT}"
execute_process(COMMAND "${Python_EXECUTABLE}" "-c" "${SCRIPT}"
RESULT_VARIABLE RETURN_CODE
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_VARIABLE Python_CORIOLISARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(SCRIPT "import os.path,distutils.sysconfig")
set(SCRIPT "${SCRIPT}; pathes = distutils.sysconfig.get_python_lib('stdlib').split('/')")
set(SCRIPT "${SCRIPT}; print( os.path.join(pathes[-2],pathes[-1]) )")
execute_process(COMMAND "${Python_EXECUTABLE}" "-c" "${SCRIPT}"
RESULT_VARIABLE RETURN_CODE
OUTPUT_VARIABLE Python_CORIOLISLIB
OUTPUT_STRIP_TRAILING_WHITESPACE
)
@ -17,14 +30,17 @@ if(UNIX)
set(FindPythonSitePackages_FOUND FALSE)
endif(RETURN_CODE EQUAL 0)
set(PYTHON_SITE_PACKAGES "lib${LIB_SUFFIX}/${PYTHON_SITE_PACKAGES}"
CACHE STRING "Python site packages directory." FORCE)
mark_as_advanced(PYTHON_SITE_PACKAGES)
set(Python_CORIOLISARCH "lib${LIB_SUFFIX}/${Python_CORIOLISARCH}"
CACHE STRING "Python platform dependent install directory." FORCE)
set(Python_CORIOLISLIB "lib${LIB_SUFFIX}/${Python_CORIOLISLIB}"
CACHE STRING "Python platform independent install directory." FORCE)
mark_as_advanced(Python_CORIOLISARCH)
mark_as_advanced(Python_CORIOLISLIB)
if(FindPythonSitePackages_FOUND)
if(NOT FindPythonSitePackages_FIND_QUIETLY)
if(FindPythonSitePackages_FOUND)
message(STATUS "Found FindPythonSitePackages : ${PYTHON_SITE_PACKAGES}")
message(STATUS "Found FindPythonSitePackages : ${Python_CORIOLISARCH}")
endif(FindPythonSitePackages_FOUND)
endif(NOT FindPythonSitePackages_FIND_QUIETLY)
else(FindPythonSitePackages_FOUND)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import re
@ -17,27 +17,23 @@ reDebugStaticPattern = re.compile( r".*Debug\.Static.*" )
def scrubPath ( pathName ):
pathEnv = os.getenv( pathName )
if not pathEnv: return ""
pathList = string.split( pathEnv, ':' )
scrubbedList = []
for pathElement in pathList:
if reCoriolisPattern .match(pathElement) \
or reReleaseSharedPattern.match(pathElement) \
or reReleaseStaticPattern.match(pathElement) \
or reDebugSharedPattern .match(pathElement) \
or reDebugStaticPattern .match(pathElement):
continue
scrubbedList += [ pathElement ]
if len(scrubbedList) == 0: return ""
scrubbedEnv = scrubbedList[0]
for pathElement in scrubbedList[1:]:
scrubbedEnv += ":" + pathElement
return scrubbedEnv
pathEnv = os.getenv( pathName )
if not pathEnv: return ""
pathList = pathEnv.split( ':' )
scrubbedList = []
for pathElement in pathList:
if reCoriolisPattern .match(pathElement) \
or reReleaseSharedPattern.match(pathElement) \
or reReleaseStaticPattern.match(pathElement) \
or reDebugSharedPattern .match(pathElement) \
or reDebugStaticPattern .match(pathElement):
continue
scrubbedList += [ pathElement ]
if len(scrubbedList) == 0: return ""
scrubbedEnv = scrubbedList[0]
for pathElement in scrubbedList[1:]:
scrubbedEnv += ":" + pathElement
return scrubbedEnv
def guessOs ():
@ -67,41 +63,41 @@ def guessOs ():
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines()
if osSlsoc7x_64.match(lines[0]): osType = "Linux.el7_64"
elif osSlsoc6x_64.match(lines[0]):
osType = "Linux.slsoc6x_64"
useDevtoolset = True
elif osSlsoc6x.match(lines[0]):
osType = "Linux.slsoc6x"
useDevtoolset = True
elif osSLSoC5x_64 .match(lines[0]): osType = "Linux.SLSoC5x_64"
elif osSLSoC5x .match(lines[0]): osType = "Linux.SLSoC5x"
elif osFedora_64 .match(lines[0]): osType = "Linux.fc_64"
elif osFedora .match(lines[0]): osType = "Linux.fc"
elif osUbuntu1004 .match(lines[0]): osType = "Linux.Ubuntu1004"
elif osUbuntu1004_64 .match(lines[0]): osType = "Linux.Ubuntu1004_64"
elif osLinux_64 .match(lines[0]): osType = "Linux.x86_64"
elif osLinux .match(lines[0]): osType = "Linux.i386"
elif osFreeBSD8x_64 .match(lines[0]): osType = "FreeBSD.8x.x86_64"
elif osFreeBSD8x_amd64.match(lines[0]): osType = "FreeBSD.8x.amd64"
elif osFreeBSD8x .match(lines[0]): osType = "FreeBSD.8x.i386"
elif osDarwin .match(lines[0]): osType = "Darwin"
elif osCygwinW7_64 .match(lines[0]): osType = "Cygwin.W7_64"
elif osCygwinW7 .match(lines[0]): osType = "Cygwin.W7"
elif osCygwinW8_64 .match(lines[0]): osType = "Cygwin.W8_64"
elif osCygwinW8 .match(lines[0]): osType = "Cygwin.W8"
elif osCygwinW10_64 .match(lines[0]): osType = "Cygwin.W10_64"
elif osCygwinW10 .match(lines[0]): osType = "Cygwin.W10"
line = lines[0].decode( 'ascii' )
if osSlsoc7x_64.match(line): osType = "Linux.el7_64"
elif osSlsoc6x_64.match(line):
osType = "Linux.slsoc6x_64"
useDevtoolset = True
elif osSlsoc6x.match(line):
osType = "Linux.slsoc6x"
useDevtoolset = True
elif osSLSoC5x_64 .match(line): osType = "Linux.SLSoC5x_64"
elif osSLSoC5x .match(line): osType = "Linux.SLSoC5x"
elif osFedora_64 .match(line): osType = "Linux.fc_64"
elif osFedora .match(line): osType = "Linux.fc"
elif osUbuntu1004 .match(line): osType = "Linux.Ubuntu1004"
elif osUbuntu1004_64 .match(line): osType = "Linux.Ubuntu1004_64"
elif osLinux_64 .match(line): osType = "Linux.x86_64"
elif osLinux .match(line): osType = "Linux.i386"
elif osFreeBSD8x_64 .match(line): osType = "FreeBSD.8x.x86_64"
elif osFreeBSD8x_amd64.match(line): osType = "FreeBSD.8x.amd64"
elif osFreeBSD8x .match(line): osType = "FreeBSD.8x.i386"
elif osDarwin .match(line): osType = "Darwin"
elif osCygwinW7_64 .match(line): osType = "Cygwin.W7_64"
elif osCygwinW7 .match(line): osType = "Cygwin.W7"
elif osCygwinW8_64 .match(line): osType = "Cygwin.W8_64"
elif osCygwinW8 .match(line): osType = "Cygwin.W8"
elif osCygwinW10_64 .match(line): osType = "Cygwin.W10_64"
elif osCygwinW10 .match(line): osType = "Cygwin.W10"
else:
uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE )
osType = uname.stdout.readlines()[0][:-1]
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: \"{}\".".format( line[:-1] ))
print( " (using: \"{}\")".format( osType ))
ldLibraryPath = os.getenv('LD_LIBRARY_PATH')
if ldLibraryPath and 'devtoolset' in ldLibraryPath: useDevtoolset = False
return (osType,useDevtoolset)
return ( osType, useDevtoolset )
def guessShell ():
@ -109,12 +105,10 @@ def guessShell ():
# the user logs in. If aftewards it changes it that variable is *not*
# affected :-(.
#if os.environ.has_key('SHELL'): return os.environ['SHELL']
psCommand = subprocess.Popen ( ['ps', '-p', str(os.getppid()) ], stdout=subprocess.PIPE )
shell = psCommand.stdout.readlines()[1][:-1].split()[3].lstrip('-')
shell = psCommand.stdout.readlines()[1].decode('ascii')[:-1].split()[3].lstrip('-')
whichCommand = subprocess.Popen ( ['which', shell ], stdout=subprocess.PIPE )
shellPath = whichCommand.stdout.readlines()[0][:-1]
isBourneShell = True
cshBins = [ '/usr/bin/tcsh'
, '/bin/tcsh'
@ -126,12 +120,10 @@ def guessShell ():
, '/usr/local/bin/csh'
]
if shellPath in cshBins: isBourneShell = False
#print 'GUESSED SHELL: "%s"' % shellPath
#print( 'GUESSED SHELL: "{}"'.format( shellPath ))
return shellPath, isBourneShell
if __name__ == "__main__":
osType,useDevtoolset = guessOs()
@ -140,7 +132,7 @@ if __name__ == "__main__":
rootDir = None
shellBin, isBourneShell = guessShell()
parser = optparse.OptionParser ()
parser = optparse.OptionParser()
# Build relateds.
parser.add_option ( "--query-inst-root", action="store_true" , dest="queryInstRoot" )
parser.add_option ( "--query-isys-root", action="store_true" , dest="queryISysRoot" )
@ -152,7 +144,7 @@ if __name__ == "__main__":
parser.add_option ( "--no-python" , action="store_true" , dest="nopython" )
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
parser.add_option ( "--remove" , action="store_true" , dest="remove" )
( options, args ) = parser.parse_args ()
( options, args ) = parser.parse_args()
if options.release: buildType = "Release"
if options.debug: buildType = "Debug"
@ -161,158 +153,143 @@ if __name__ == "__main__":
if options.shared: linkType = "Shared"
if options.rootDir: rootDir = options.rootDir
scriptPath = os.path.abspath(os.path.dirname(sys.argv[0]))
scriptPath = os.path.abspath( os.path.dirname( sys.argv[0] ))
if 'Debug.' in scriptPath: buildType = 'Debug'
if not shellBin:
print 'echo "[ERROR] coriolisEnv.py was not able to guess/find the current shell interpeter."'
sys.exit( 1 )
print( 'echo "[ERROR] coriolisEnv.py was not able to guess/find the current shell interpeter."' )
sys.exit( 1 )
strippedPath = scrubPath( "PATH" )
strippedLibraryPath = scrubPath( "LD_LIBRARY_PATH" )
strippedPythonPath = scrubPath( "PYTHONPATH" )
if options.remove:
shellScript = 'echo "Removing Coriolis environment";'
if osType == "Darwin":
ldVar = 'DYLD_LIBRARY_PATH'
else:
ldVar = 'LD_LIBRARY_PATH'
if isBourneShell:
shellScript += 'export PATH={};hash -r;'.format(strippedPath)
shellScript += 'BOOTSTRAP_TOP="";CORIOLIS_TOP="";export -n BOOTSTRAP_TOP CORIOLIS_TOP;'
if strippedLibraryPath:
shellScript += 'export {}={};'.format(ldVar, strippedLibraryPath)
shellScript = 'echo "Removing Coriolis environment";'
if osType == "Darwin":
ldVar = 'DYLD_LIBRARY_PATH'
else:
shellScript += '{0}=""; export -n {0};'.format(ldVar)
else:
shellScript += 'setenv PATH {};rehash;'.format(strippedPath)
shellScript += 'unsetenv BOOTSTRAP_TOP CORIOLIS_TOP;'
if strippedLibraryPath:
shellScript += 'setenv {} {};'.format(ldVar, strippedLibraryPath)
ldVar = 'LD_LIBRARY_PATH'
if isBourneShell:
shellScript += 'export PATH={};hash -r;'.format(strippedPath)
shellScript += 'BOOTSTRAP_TOP="";CORIOLIS_TOP="";export -n BOOTSTRAP_TOP CORIOLIS_TOP;'
if strippedLibraryPath:
shellScript += 'export {}={};'.format(ldVar, strippedLibraryPath)
else:
shellScript += '{0}=""; export -n {0};'.format(ldVar)
else:
shellScript += 'unsetenv {};'.format(ldVar)
print(shellScript)
sys.exit(0)
shellScript += 'setenv PATH {};rehash;'.format(strippedPath)
shellScript += 'unsetenv BOOTSTRAP_TOP CORIOLIS_TOP;'
if strippedLibraryPath:
shellScript += 'setenv {} {};'.format(ldVar, strippedLibraryPath)
else:
shellScript += 'unsetenv {};'.format(ldVar)
print( shellScript )
sys.exit(0)
shellScriptSh = \
'echo "%(MESSAGE)s";' \
'echo "Switching to Coriolis 2.x (%(buildDir)s)";' \
'PATH="%(PATH)s";' \
'BOOTSTRAP_TOP="%(BOOTSTRAP_TOP)s";' \
'CORIOLIS_TOP="%(CORIOLIS_TOP)s";' \
'export PATH BOOTSTRAP_TOP CORIOLIS_TOP STRATUS_MAPPING_NAME;'
'echo "%(MESSAGE)s";' \
'echo "Switching to Coriolis 2.x (%(buildDir)s)";' \
'PATH="%(PATH)s";' \
'BOOTSTRAP_TOP="%(BOOTSTRAP_TOP)s";' \
'CORIOLIS_TOP="%(CORIOLIS_TOP)s";' \
'export PATH BOOTSTRAP_TOP CORIOLIS_TOP STRATUS_MAPPING_NAME;'
# 'STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
# 'STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
shellScriptCsh = \
'echo "%(MESSAGE)s";' \
'echo "Switching to Coriolis 2.x (%(buildDir)s)";' \
'setenv PATH "%(PATH)s";' \
'setenv BOOTSTRAP_TOP "%(BOOTSTRAP_TOP)s";' \
'setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";'
'echo "%(MESSAGE)s";' \
'echo "Switching to Coriolis 2.x (%(buildDir)s)";' \
'setenv PATH "%(PATH)s";' \
'setenv BOOTSTRAP_TOP "%(BOOTSTRAP_TOP)s";' \
'setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";'
# 'setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
# 'setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
reDevtoolset = re.compile( r'/opt/rh/devtoolset-(?P<version>\d+)/root/etc/coriolis2.*' )
buildDir = buildType + "." + linkType
scriptDir = os.path.dirname ( os.path.abspath(__file__) )
#print "echo \"Script Location: %s\";" % scriptDir,
#print( "echo \"Script Location: {}\";".format( scriptDir ))
if scriptDir.startswith("/etc/coriolis2"):
coriolisTop = "/usr"
sysconfDir = scriptDir
shellMessage = "Using system-wide Coriolis 2 (/usr)"
coriolisTop = "/usr"
sysconfDir = scriptDir
shellMessage = "Using system-wide Coriolis 2 (/usr)"
else:
m = reDevtoolset.match( scriptDir )
if m:
coriolisTop = "/opt/rh/devtoolset-%d/root/usr" % m.group('version')
sysconfDir = scriptDir
shellMessage = "Using system-wide devtoolset-%(v)d Coriolis 2 (/opt/rh/devtoolset-%(v)d/root/usr)" \
% { 'v':m.group('version') }
elif scriptDir.startswith(os.getenv("HOME")+"/nightly/coriolis-2.x/"):
rootDir = os.getenv("HOME") + "/nightly/coriolis-2.x"
coriolisTop = "%s/%s/%s/install" % ( rootDir, osType, buildDir )
sysconfDir = scriptDir
shellMessage = "Using Nightly build Coriolis 2 (%s)" % coriolisTop
elif scriptDir.startswith("/users/outil/coriolis/coriolis-2.x/") \
or scriptDir.startswith("/soc/coriolis2/"):
coriolisTop = "/soc/coriolis2"
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using SoC network-wide Coriolis 2 (/soc/coriolis2)"
else:
if not rootDir:
rootDir = os.getenv("HOME") + "/coriolis-2.x"
coriolisTop = "%s/%s/%s/install" % ( rootDir, osType, buildDir )
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using user-selected Coriolis 2 (%s)" % rootDir
m = reDevtoolset.match( scriptDir )
if m:
coriolisTop = "/opt/rh/devtoolset-%d/root/usr" % m.group('version')
sysconfDir = scriptDir
shellMessage = "Using system-wide devtoolset-%(v)d Coriolis 2 (/opt/rh/devtoolset-%(v)d/root/usr)" \
% { 'v':m.group('version') }
elif scriptDir.startswith(os.getenv("HOME")+"/nightly/coriolis-2.x/"):
rootDir = os.getenv("HOME") + "/nightly/coriolis-2.x"
coriolisTop = "%s/%s/%s/install" % ( rootDir, osType, buildDir )
sysconfDir = scriptDir
shellMessage = "Using Nightly build Coriolis 2 (%s)" % coriolisTop
elif scriptDir.startswith("/users/outil/coriolis/coriolis-2.x/") \
or scriptDir.startswith("/soc/coriolis2/"):
coriolisTop = "/soc/coriolis2"
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using SoC network-wide Coriolis 2 (/soc/coriolis2)"
else:
if not rootDir:
rootDir = os.getenv("HOME") + "/coriolis-2.x"
coriolisTop = "%s/%s/%s/install" % ( rootDir, osType, buildDir )
sysconfDir = coriolisTop + "/etc/coriolis2"
shellMessage = "Using user-selected Coriolis 2 (%s)" % rootDir
if osType.startswith("Cygwin"):
strippedPath = "%s/lib:%s" % ( coriolisTop, libDir, strippedPath )
strippedPath = "%s/lib:%s" % ( coriolisTop, libDir, strippedPath )
if not os.path.exists(coriolisTop):
print 'echo "[ERROR] coriolisEnv.py, top directory <%s> do not exists."' % coriolisTop
sys.exit( 1 )
print( 'echo "[ERROR] coriolisEnv.py, top directory <%s> do not exists."'.format( coriolisTop ))
sys.exit( 1 )
for lib in [ 'lib64', 'lib' ]:
libDir = lib
absLibDir = '{0}/{1}'.format( coriolisTop, lib )
if os.path.isdir(absLibDir): break
libDir = None
libDir = lib
absLibDir = '{0}/{1}'.format( coriolisTop, lib )
if os.path.isdir(absLibDir): break
libDir = None
if libDir is None:
print 'echo "[ERROR] coriolisEnv.py, library directory not found."'
sys.exit( 1 )
print( 'echo "[ERROR] coriolisEnv.py, library directory not found."' )
sys.exit( 1 )
strippedPath = "%s/bin:%s" % ( coriolisTop, strippedPath )
strippedLibraryPath = "%s:%s" % ( absLibDir , strippedLibraryPath )
if not options.nopython:
pyVersion = sys.version_info
version = "%d.%d" % (pyVersion[0],pyVersion[1])
sitePackagesDir = "sitePackageDir_has_been_not_found"
for pyPackageDir in [ "%s/python%s/site-packages" % (absLibDir,version)
, "%s/python%s/dist-packages" % (absLibDir,version)
, "%s/%s/site-packages" % (absLibDir,version)
]:
if os.path.isdir(pyPackageDir):
sitePackagesDir = pyPackageDir
break
strippedPythonPath = "%s:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/crlcore:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/cumulus:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/cumulus/plugins:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/stratus:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s:" % (sysconfDir) + strippedPythonPath
shellScriptSh += 'PYTHONPATH="%(PYTHONPATH)s";' \
'export PYTHONPATH;'
shellScriptCsh += 'setenv PYTHONPATH "%(PYTHONPATH)s";'
if osType == "Darwin":
shellScriptSh += 'DYLD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
'export DYLD_LIBRARY_PATH;'
shellScriptCsh += 'setenv DYLD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";'
else:
shellScriptSh += 'LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
'export LD_LIBRARY_PATH;'
shellScriptCsh += 'setenv LD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";'
pyVersion = sys.version_info
version = "%d.%d" % (pyVersion[0],pyVersion[1])
sitePackagesDir = "sitePackageDir_has_been_not_found"
for pyPackageDir in [ "%s/python%s/site-packages" % (absLibDir,version)
, "%s/python%s/dist-packages" % (absLibDir,version)
, "%s/%s/site-packages" % (absLibDir,version)
]:
if os.path.isdir(pyPackageDir):
sitePackagesDir = pyPackageDir
break
strippedPythonPath = "%s:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/crlcore:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/cumulus:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/cumulus/plugins:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/stratus:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s:" % (sysconfDir) + strippedPythonPath
shellScriptSh += 'PYTHONPATH="%(PYTHONPATH)s";' \
'export PYTHONPATH;'
shellScriptCsh += 'setenv PYTHONPATH "%(PYTHONPATH)s";'
if osType == "Darwin":
shellScriptSh += 'DYLD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
'export DYLD_LIBRARY_PATH;'
shellScriptCsh += 'setenv DYLD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";'
else:
shellScriptSh += 'LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";' \
'export LD_LIBRARY_PATH;'
shellScriptCsh += 'setenv LD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";'
shellScriptSh += "hash -r;"
shellScriptCsh += "rehash;"
if isBourneShell: shellScript = shellScriptSh
else: shellScript = shellScriptCsh
if useDevtoolset:
shellScript += \
' echo "Launching a devtoolset-8 subshell though scl (CTRL+D to exit).";' \
' scl enable devtoolset-8 %(SHELL)s'
shellScript += \
' echo "Launching a devtoolset-8 subshell though scl (CTRL+D to exit).";' \
' scl enable devtoolset-8 %(SHELL)s'
evalScript = shellScript % { "PATH" : strippedPath
, "LD_LIBRARY_PATH" : strippedLibraryPath
@ -325,12 +302,10 @@ if __name__ == "__main__":
, 'SHELL' : shellBin
}
if options.queryISysRoot:
print '%s/%s' % (rootDir,osType)
sys.exit( 0 )
print( '{}/{}'.format( rootDir, osType ))
sys.exit( 0 )
if options.queryInstRoot:
print coriolisTop
sys.exit( 0 )
print evalScript
print( coriolisTop )
sys.exit( 0 )
print( evalScript )
sys.exit( 0 )

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2015-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2015-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -24,77 +24,73 @@
showTrace = True
try:
import sys
import os.path
import shutil
import optparse
import time
import traceback
import distutils.sysconfig
import subprocess
import socket
import re
import bz2
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
except ImportError, e:
module = str(e).split()[-1]
import sys
import os.path
import shutil
import optparse
import time
import traceback
import distutils.sysconfig
import subprocess
import socket
import re
import bz2
import smtplib
from io import IOBase
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
except ImportError as e:
module = str(e).split()[-1]
class ErrorMessage ( Exception ):
def __init__ ( self, code, *arguments ):
self._code = code
self._errors = [ 'Malformed call to ErrorMessage()', '%s' % str(arguments) ]
self._errors = [ 'Malformed call to ErrorMessage()', '{}'.format(arguments) ]
text = None
if len(arguments) == 1:
if isinstance(arguments[0],Exception): text = str(arguments[0]).split('\n')
else:
self._errors = arguments[0]
elif len(arguments) > 1:
text = list(arguments)
if text:
self._errors = []
while len(text[0]) == 0: del text[0]
lstrip = 0
if text[0].startswith('[ERROR]'): lstrip = 8
for line in text:
if line[0:lstrip ] == ' '*lstrip or \
line[0:lstrip-1] == '[ERROR]':
self._errors += [ line[lstrip:] ]
if isinstance(arguments[0],Exception): text = str(arguments[0]).split('\n')
else:
self._errors += [ line.lstrip() ]
self._errors = arguments[0]
elif len(arguments) > 1:
text = list(arguments)
if text:
self._errors = []
while len(text[0]) == 0: del text[0]
lstrip = 0
if text[0].startswith('[ERROR]'): lstrip = 8
for line in text:
if line[0:lstrip ] == ' '*lstrip or \
line[0:lstrip-1] == '[ERROR]':
self._errors += [ line[lstrip:] ]
else:
self._errors += [ line.lstrip() ]
return
def __str__ ( self ):
if not isinstance(self._errors,list):
return "[ERROR] %s" % self._errors
return "[ERROR] {}".format(self._errors)
formatted = "\n"
for i in range(len(self._errors)):
if i == 0: formatted += "[ERROR] %s" % self._errors[i]
else: formatted += " %s" % self._errors[i]
if i+1 < len(self._errors): formatted += "\n"
if i == 0: formatted += "[ERROR] {}".format(self._errors[i])
else: formatted += " {}".format(self._errors[i])
if i+1 < len(self._errors): formatted += "\n"
return formatted
def addMessage ( self, message ):
if not isinstance(self._errors,list):
self._errors = [ self._errors ]
self._errors = [ self._errors ]
if isinstance(message,list):
for line in message:
self._errors += [ line ]
for line in message:
self._errors += [ line ]
else:
self._errors += [ message ]
self._errors += [ message ]
return
def terminate ( self ):
print self
print( self )
sys.exit(self._code)
@property
@ -104,14 +100,14 @@ class ErrorMessage ( Exception ):
class BadBinary ( ErrorMessage ):
def __init__ ( self, binary ):
ErrorMessage.__init__( self, 1, "Binary not found: <%s>." % binary )
ErrorMessage.__init__( self, 1, 'Binary not found: "{}".'.format(binary) )
return
class BadReturnCode ( ErrorMessage ):
def __init__ ( self, status ):
ErrorMessage.__init__( self, 1, "Command returned status:%d." % status )
ErrorMessage.__init__( self, 1, 'Command returned status:{}.'.format(status) )
return
@ -120,25 +116,31 @@ class Command ( object ):
def __init__ ( self, arguments, fdLog=None ):
self.arguments = arguments
self.fdLog = fdLog
if self.fdLog != None and not isinstance(self.fdLog,file):
print '[WARNING] Command.__init__(): <fdLog> is neither None or a file.'
if self.fdLog != None and not isinstance(self.fdLog,IOBase):
print( '[WARNING] Command.__init__(): "fdLog" is neither None or a file.' )
return
def _argumentsToStr ( self, arguments ):
s = ''
for argument in arguments:
if argument.find(' ') >= 0: s += ' "' + argument + '"'
else: s += ' ' + argument
if argument.find(' ') >= 0: s += ' "' + argument + '"'
else: s += ' ' + argument
return s
def log ( self, text ):
print text[:-1]
if isinstance(self.fdLog,IOBase):
if isinstance(text,bytes):
print( text[:-1].decode('utf-8') )
self.fdLog.write( text.decode('utf-8') )
elif isinstance(text,str):
print( text[:-1] )
self.fdLog.write( text )
else:
print( '[ERROR] Command.log(): "text" is neither bytes or str.' )
print( ' {}'.format(text) )
self.fdLog.flush()
sys.stdout.flush()
sys.stderr.flush()
if isinstance(self.fdLog,file):
self.fdLog.write( text )
self.fdLog.flush()
return
def execute ( self ):
@ -149,29 +151,26 @@ class Command ( object ):
homeDir = os.environ['HOME']
workDir = os.getcwd()
if homeDir.startswith(homeDir):
workDir = '~' + workDir[ len(homeDir) : ]
workDir = '~' + workDir[ len(homeDir) : ]
user = 'root'
if os.environ.has_key('USER'): user = os.environ['USER']
prompt = '%s@%s:%s$' % (user,conf.masterHost,workDir)
if 'USER' in os.environ: user = os.environ['USER']
prompt = '{}@{}:{}$'.format(user,conf.masterHost,workDir)
try:
self.log( '%s%s\n' % (prompt,self._argumentsToStr(self.arguments)) )
print self.arguments
child = subprocess.Popen( self.arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
while True:
line = child.stdout.readline()
if not line: break
self.log( line )
except OSError, e:
raise BadBinary( self.arguments[0] )
self.log( '{}{}\n'.format(prompt,self._argumentsToStr(self.arguments)) )
print( self.arguments )
child = subprocess.Popen( self.arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
while True:
line = child.stdout.readline()
if not line: break
self.log( line )
except OSError as e:
raise BadBinary( self.arguments[0] )
(pid,status) = os.waitpid( child.pid, 0 )
status >>= 8
if status != 0:
raise BadReturnCode( status )
raise BadReturnCode( status )
return
@ -186,11 +185,10 @@ class CommandArg ( object ):
def __str__ ( self ):
s = ''
if self.wd: s = 'cd %s && ' % self.wd
if self.wd: s = 'cd {} && '.format(self.wd)
for i in range(len(self.command)):
if i: s += ' '
s += self.command[i]
if i: s += ' '
s += self.command[i]
return s
def getArgs ( self ):
@ -223,7 +221,7 @@ class CoriolisCommand ( CommandArg ):
CommandArg.__init__ ( self, [ ccbBin
, '--root='+rootDir
, '--project=coriolis'
, '--make=-j%d install' % threads
, '--make=-j{} install'.format(threads)
] + otherArgs
, fdLog=fdLog )
return
@ -258,21 +256,20 @@ class GitRepository ( object ):
def removeLocalRepo ( self ):
if os.path.isdir(self.localRepoDir):
print 'Removing Git local repository: <%s>' % self.localRepoDir
shutil.rmtree( self.localRepoDir )
print( 'Removing Git local repository: "{}"'.format(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 )
os.makedirs( self.cloneDir )
if not os.path.isdir(self.localRepoDir):
os.chdir( self.cloneDir )
Command( [ 'git', 'clone', self.url ], self.fdLog ).execute()
os.chdir( self.cloneDir )
Command( [ 'git', 'clone', self.url ], self.fdLog ).execute()
else:
os.chdir( self.localRepoDir )
Command( [ 'git', 'pull' ], self.fdLog ).execute()
os.chdir( self.localRepoDir )
Command( [ 'git', 'pull' ], self.fdLog ).execute()
return
def checkout ( self, branch ):
@ -323,28 +320,26 @@ class Configuration ( object ):
self._masterHost = self._detectMasterHost()
self._success = False
self._rcode = 0
self._updateSecondaries()
return
def __setattr__ ( self, attribute, value ):
if attribute in Configuration.SecondaryNames:
print ErrorMessage( 1, 'Attempt to write in read-only attribute <%s> in Configuration.'%attribute )
return
print( ErrorMessage( 1, 'Attempt to write in read-only attribute "{}" in Configuration.' \
.format(attribute) ))
return
if attribute == 'masterHost' or attribute == '_masterHost':
if value == 'lepka':
print 'Never touch the Git tree when running on <lepka>.'
self._rmSource = False
self._rmBuild = False
self._doGit = False
self._doSendReport = False
if value == 'lepka':
print( 'Never touch the Git tree when running on "lepka".' )
self._rmSource = False
self._rmBuild = False
self._doGit = False
self._doSendReport = False
if attribute[0] == '_':
self.__dict__[attribute] = value
return
if attribute == 'homeDir': value = os.path.expanduser(value)
self.__dict__[attribute] = value
return
if attribute == 'homeDir': value = os.path.expanduser(value)
self.__dict__['_'+attribute] = value
self._updateSecondaries()
@ -352,15 +347,15 @@ class Configuration ( object ):
def __getattr__ ( self, attribute ):
if attribute[0] != '_': attribute = '_'+attribute
if not self.__dict__.has_key(attribute):
raise ErrorMessage( 1, 'Configuration has no attribute <%s>.'%attribute )
if not attribute in self.__dict__:
raise ErrorMessage( 1, 'Configuration has no attribute "{}".'.format(attribute) )
return self.__dict__[attribute]
def _updateSecondaries ( self ):
if self._nightlyMode:
self._rootDir = self._homeDir + '/nightly/coriolis-2.x'
self._rootDir = self._homeDir + '/nightly/coriolis-2.x'
else:
self._rootDir = self._homeDir + '/coriolis-2.x'
self._rootDir = self._homeDir + '/coriolis-2.x'
self._srcDir = self._rootDir + '/src'
self._logDir = self._srcDir + '/logs'
self._yosysBin = self._srcDir + '/' + GitRepository.getLocalRepository(self._coriolisRepo) + '/bootstrap/yosysInstaller.sh'
@ -373,27 +368,24 @@ class Configuration ( object ):
def _detectMasterHost ( self ):
if self._chrootMode is None: return 'unknown'
if self._chrootMode: return 'chrooted-host'
masterHost = 'unknown'
hostname = socket.gethostname()
hostAddr = socket.gethostbyname(hostname)
if hostname == 'lepka' and hostAddr == '127.0.0.1':
masterHost = 'lepka'
masterHost = 'lepka'
else:
masterHost = hostname.split('.')[0]
masterHost = hostname.split('.')[0]
return masterHost
def openLog ( self, stem ):
if not os.path.isdir(self._logDir):
os.makedirs( self._logDir )
os.makedirs( self._logDir )
index = 0
timeTag = time.strftime( "%Y.%m.%d" )
while True:
logFile = os.path.join(self._logDir,"%s-%s-%02d.log" % (stem,timeTag,index))
logFile = os.path.join(self._logDir,"{}-{}-{:02}.log".format(stem,timeTag,index))
if not os.path.isfile(logFile):
print "Report log: <%s>" % logFile
print( 'Report log: "{}"'.format(logFile) )
break
index += 1
fd = open( logFile, "w" )
@ -403,65 +395,59 @@ class Configuration ( object ):
def closeLogs ( self ):
for fd in self._fds.values():
if fd: fd.close()
if fd: fd.close()
return
def compressLogs ( self ):
for log in self._logs.values():
if not log: continue
fd = open( log, 'r' )
bzfd = bz2.BZ2File( log+'.bz2', 'w' )
for line in fd.readlines(): bzfd.write( line )
bzfd.close()
fd.close()
os.unlink( log )
if not log: continue
fd = open( log, 'r' )
bzfd = bz2.BZ2File( log+'.bz2', 'w' )
for line in fd.readlines():
if isinstance(line,str):
bzfd.write( line.encode('utf-8') )
elif isinstance(line,bytes):
bzfd.write( line )
bzfd.close()
fd.close()
os.unlink( log )
return
def getCommands ( self, target ):
commands = []
commands = []
if self.doYosys:
if not os.path.isfile( self.yosysBin ):
raise ErrorMessage( 1, [ 'Cannot find <yosysInstaller.sh>, should be here:'
, ' <%s>' % self.yosysBin
] )
commands.append( YosysCommand( self.yosysBin, fdLog=self.fds['yosys'] ) )
if not os.path.isfile( self.yosysBin ):
raise ErrorMessage( 1, [ 'Cannot find <yosysInstaller.sh>, should be here:'
, ' "{}"'.format(self.yosysBin)
] )
commands.append( YosysCommand( self.yosysBin, fdLog=self.fds['yosys'] ) )
if self.doAlliance:
if not os.path.isfile( self.alcBin ):
raise ErrorMessage( 1, [ 'Cannot find <allianceInstaller.sh>, should be here:'
, ' <%s>' % self.alcBin
] )
commands.append( AllianceCommand( self.alcBin, fdLog=self.fds['alliance'] ) )
if not os.path.isfile( self.alcBin ):
raise ErrorMessage( 1, [ 'Cannot find <allianceInstaller.sh>, should be here:'
, ' "{}"'.format(self.alcBin)
] )
commands.append( AllianceCommand( self.alcBin, fdLog=self.fds['alliance'] ) )
if self.doCoriolis:
if not os.path.isfile( self.ccbBin ):
raise ErrorMessage( 1, [ 'Cannot find <ccb.py>, should be here:'
, ' <%s>' % self.ccbBin
] )
otherArgs = []
if self.debugArg: otherArgs.append( self.debugArg )
if target == 'SL7_64':
otherArgs.append( '--project=support' )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 3, otherArgs , fdLog=self.fds['coriolis'] ) )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) )
elif target == 'SL6_64' or target == 'SL6':
otherArgs.append( '--project=support' )
otherArgs.append( '--devtoolset=8' )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 6, otherArgs , fdLog=self.fds['coriolis'] ) )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) )
elif target == 'Ubuntu18' or target == 'Debian9' or target == 'Debian10':
if target == 'Ubuntu18': otherArgs.append( '--qt5' )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 3, otherArgs, fdLog=self.fds['coriolis'] ) )
if not os.path.isfile( self.ccbBin ):
raise ErrorMessage( 1, [ 'Cannot find <ccb.py>, should be here:'
, ' "{}"'.format(self.ccbBin)
] )
otherArgs = []
if self.debugArg: otherArgs.append( self.debugArg )
if target == 'SL7_64':
otherArgs.append( '--project=support' )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 3, otherArgs , fdLog=self.fds['coriolis'] ) )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) )
elif target == 'SL6_64' or target == 'SL6':
otherArgs.append( '--project=support' )
otherArgs.append( '--devtoolset=8' )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 6, otherArgs , fdLog=self.fds['coriolis'] ) )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) )
elif target == 'Ubuntu18' or target == 'Debian9' or target == 'Debian10':
if target == 'Ubuntu18': otherArgs.append( '--qt5' )
commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 3, otherArgs, fdLog=self.fds['coriolis'] ) )
if self.doBenchs:
commands.append( BenchsCommand( self.benchsDir, fdLog=self.fds['benchs'] ) )
commands.append( BenchsCommand( self.benchsDir, fdLog=self.fds['benchs'] ) )
return commands
@ -469,33 +455,30 @@ class Report ( object ):
def __init__ ( self, conf ):
self.conf = conf
commaspace = ', '
date = time.strftime( "%A %d %B %Y" )
stateText = 'FAILED'
modeText = 'SoC installation'
if self.conf.success: stateText = 'SUCCESS'
if self.conf.nightlyMode: modeText = 'Nightly build'
self.message = MIMEMultipart()
self.message['Subject'] = '[%s] Coriolis %s %s' % (stateText,modeText,date)
self.message['Subject'] = '[{}] Coriolis {} {}'.format(stateText,modeText,date)
self.message['From' ] = self.conf.sender
self.message['To' ] = commaspace.join( self.conf.receivers )
self.attachements = []
self.mainText = '\n'
self.mainText += 'Salut le Crevard,\n'
self.mainText += '\n'
if self.conf.nightlyMode:
self.mainText += 'This is the nightly build report of Coriolis.\n'
self.mainText += 'This is the nightly build report of Coriolis.\n'
else:
self.mainText += 'SoC installer report of Coriolis.\n'
self.mainText += '%s\n' % date
self.mainText += 'SoC installer report of Coriolis.\n'
self.mainText += '{}\n'.format(date)
self.mainText += '\n'
if self.conf.success:
self.mainText += 'Build was SUCCESSFUL\n'
self.mainText += 'Build was SUCCESSFUL\n'
else:
self.mainText += 'Build has FAILED, please have a look to the attached log file(s).\n'
self.mainText += 'Build has FAILED, please have a look to the attached log file(s).\n'
self.mainText += '\n'
self.mainText += 'Complete log file(s) can be found here:\n'
return
@ -505,28 +488,27 @@ class Report ( object ):
fd = open( logFile, 'rb' )
try:
fd.seek( -1024*100, os.SEEK_END )
except IOError, e:
pass
fd.seek( -1024*100, os.SEEK_END )
except IOError as e:
pass
tailLines = ''
for line in fd.readlines()[1:]:
tailLines += line
tailLines += line
fd.close()
self.mainText += ' <%s>\n' % logFile
self.mainText += ' "{}"\n'.format(logFile)
attachement = MIMEApplication(tailLines)
attachement.add_header( 'Content-Disposition', 'attachment', filename=os.path.basename(logFile) )
self.attachements.append( attachement )
return
def send ( self ):
self.message.attach( MIMEText(self.mainText) )
for attachement in self.attachements:
self.message.attach( attachement )
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( ' <{}>'.format(receiver) )
session = smtplib.SMTP( 'localhost' )
session.sendmail( self.conf.sender, self.conf.receivers, self.message.as_string() )
session.quit()
@ -577,7 +559,6 @@ try:
if conf.doAlliance: conf.openLog( 'alliance' )
if conf.doCoriolis: conf.openLog( 'coriolis' )
if conf.doBenchs: conf.openLog( 'benchs' )
if conf.dockerMode: os.environ['USER'] = 'root'
gitSupports = []
@ -613,29 +594,28 @@ 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: "{}"'.format(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 "{}":'.format(host) )
else:
print 'Executing command on *local* host:'
print ' %s' % str(command)
print( 'Executing command on *local* host:' )
print( ' {}'.format(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

View File

@ -14,15 +14,14 @@
setup_project_paths(CORIOLIS)
set_cmake_policies()
setup_boost(program_options filesystem python regex)
setup_boost(program_options)
setup_qt()
setup_qwt()
find_package(Libexecinfo REQUIRED)
find_package(PythonLibs 2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(FLUTE REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -1,2 +1,2 @@
install ( FILES boraInit.py DESTINATION ${PYTHON_SITE_PACKAGES}/bora )
install ( FILES boraInit.py DESTINATION ${Python_CORIOLISLIB}/bora )

View File

@ -1,29 +1,27 @@
#!/usr/bin/env python
try:
import sys
import os.path
import helpers.io
from helpers.io import ErrorMessage
from helpers.io import WarningMessage
import Viewer
except Exception, e:
helpers.io.catch( e )
sys.exit( 1 )
import sys
import os.path
import helpers.io
from helpers.io import ErrorMessage
from helpers.io import WarningMessage
import Viewer
except Exception as e:
helpers.io.catch( e )
sys.exit( 1 )
def boraHook ( **kw ):
bora = None
if kw.has_key('bora'):
bora = kw['bora']
if 'bora' in kw:
bora = kw['bora']
else:
print ErrorMessage( 3, 'boraHook(): Must be run from a BoraEngine.' )
return
print( ErrorMessage( 3, 'boraHook(): Must be run from a BoraEngine.' ))
return
try:
userInit = os.path.join( os.getcwd(), 'coriolis2/bora.py' )
if (os.path.exists(userInit)):
execfile( userInit )
except Exception, e:
helpers.io.catch( e )
userInit = os.path.join( os.getcwd(), 'coriolis2/bora.py' )
if (os.path.exists(userInit)):
exec( open(userInit).read() )
except Exception as e:
helpers.io.catch( e )
return

View File

@ -7,7 +7,7 @@
${Boost_INCLUDE_DIRS}
${QWT_INCLUDE_DIR}
${QtX_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${Python_INCLUDE_DIRS}
)
set( includes bora/Constants.h
bora/ParameterRange.h
@ -99,7 +99,7 @@
${QWT_LIBRARY}
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${PYTHON_LIBRARIES} -lutil
${Python_LIBRARIES} -lutil
)
add_library( bora ${cpps} ${mocCpps} ${pyCpps} )

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2016-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
@ -63,12 +63,21 @@ extern "C" {
};
// ---------------------------------------------------------------
// Module Initialization : "initBora ()"
static PyModuleDef PyBora_ModuleDef =
{ PyModuleDef_HEAD_INIT
, .m_name = "Bora"
, .m_doc = "Analog Place & Global Route."
, .m_size = -1
, .m_methods = PyBora_Methods
};
DL_EXPORT(void) initBora ()
// ---------------------------------------------------------------
// Module Initialization : "PyInit_Bora ()"
PyMODINIT_FUNC PyInit_Bora ( void )
{
cdebug.log(61) << "initBora()" << endl;
cdebug.log(61) << "PyInit_Bora()" << endl;
PyParameterRange_LinkPyType();
PyStepParameterRange_LinkPyType();
@ -95,12 +104,11 @@ extern "C" {
PYTYPE_READY_SUB( BoraEngine , ToolEngine );
PYTYPE_READY_SUB( GraphicBoraEngine , GraphicTool );
PyObject* module = Py_InitModule( "Bora", PyBora_Methods );
PyObject* module = PyModule_Create( &PyBora_ModuleDef );
if (module == NULL) {
cerr << "[ERROR]\n"
<< " Failed to initialize Bora module." << endl;
return;
return NULL;
}
Py_INCREF( &PyTypeParameterRange );
@ -128,6 +136,8 @@ extern "C" {
PySlicingNode_postModuleInit();
PyBoraEngine_postModuleInit();
return module;
}

View File

@ -62,12 +62,12 @@ extern "C" {
DSlicingNode* node = NULL;
HTRY
if (not PyArg_ParseTuple( args,"SOO|O:DSlicingNode.create"
if (not PyArg_ParseTuple( args,"OOO|O:DSlicingNode.create"
, &pyInstance
, &pyCell
, &pyParameterRange
, &pyRoutingGauge ) ) {
PyErr_SetString ( ConstructorError, "DSlicingNode.create(): Invalid/bad number of parameters ." );
PyErr_SetString ( ConstructorError, "DSlicingNode.create(): Invalid/bad number of parameters." );
return NULL;
}
if (not IsPyCell(pyCell)) {

View File

@ -19,20 +19,19 @@
set_cmake_policies()
check_distribution()
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
setup_boost(program_options python regex wave)
setup_boost(program_options)
setup_qt()
if (USE_LIBBFD)
find_package(Libbfd)
endif()
find_package(LibXml2 REQUIRED)
find_package(PythonLibs 2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(LEFDEF)
find_package(OPENACCESS)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(Libexecinfo REQUIRED)
#include(UseLATEX)

View File

@ -54,6 +54,6 @@ def loadGdsLayers ( gdsLayersTable ):
basicLayer.setGds2Layer ( gdsiiLayer )
basicLayer.setGds2Datatype( gdsiiDatatype )
except Exception, e:
except Exception as e:
helpers.io.catch( e )
return

View File

@ -54,7 +54,7 @@ def toRGB ( color ):
, str(options[attribute])] )
# Try a predefined color lookup.
if stdColors.has_key(color): return stdColors[color]
if color in stdColors: return stdColors[color]
# Try a RGB hexa: #RRGGBB.
if color[0] == '#':

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -26,23 +26,21 @@ def addDevice ( **kw ):
global tech
try:
if kw.has_key('name'):
devDesc = tech.addDeviceDescriptor( kw['name'] )
if kw.has_key('spice'):
devDesc.setSpiceFilePath( kw['spice'] )
if kw.has_key('connectors'):
for connector in kw['connectors']:
devDesc.addConnector( connector )
else:
print WarningMessage( 'common.addDevice(): Missing connectors on device "%s".' % kw['name' ])
if kw.has_key('layouts'):
for layout in kw['layouts']:
devDesc.addLayout( layout[0], layout[1] )
else:
print WarningMessage( 'common.addDevice(): Missing layouts on device "%s".' % kw['name' ])
except Exception, e:
helpers.io.catch( e )
if 'name' in kw:
devDesc = tech.addDeviceDescriptor( kw['name'] )
if 'spice' in kw: devDesc.setSpiceFilePath( kw['spice'] )
if 'connectors' in kw:
for connector in kw['connectors']:
devDesc.addConnector( connector )
else:
print( WarningMessage( 'common.addDevice(): Missing connectors on device "{}".' \
.format(kw['name'])))
if 'layouts' in kw:
for layout in kw['layouts']:
devDesc.addLayout( layout[0], layout[1] )
else:
print( WarningMessage( 'common.addDevice(): Missing layouts on device "{}".' \
.format( kw['name'] )))
except Exception as e:
helpers.io.catch( e )
return

View File

@ -31,10 +31,10 @@ layout.addTitle ( 'Kite', 'Kite - Detailed Router' )
layout.addParameter( 'Kite', 'kite.hTracksReservedLocal', 'Vert. Locally Reserved Tracks', 0 )
layout.addParameter( 'Kite', 'kite.vTracksReservedLocal', 'Hor. Locally Reserved Tracks' , 0 )
layout.addParameter( 'Kite', 'kite.eventsLimit' , 'Events Limit' , 0 )
layout.addParameter( 'Kite', 'kite.ripupCost' , 'Ripup Cost' , 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.ripupCost' , 'Ripup Cost' , 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addSection ( 'Kite', 'Ripup Limits', 1 )
layout.addParameter( 'Kite', 'kite.strapRipupLimit' , 'Straps' , 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.localRipupLimit' , 'Locals' , 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.globalRipupLimit' , 'Globals' , 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.longGlobalRipupLimit', 'Long Globals', 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.strapRipupLimit' , 'Straps' , 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.localRipupLimit' , 'Locals' , 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.globalRipupLimit' , 'Globals' , 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.longGlobalRipupLimit', 'Long Globals', 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addRule ( 'Kite' )

View File

@ -1,13 +1,13 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | Alliance / Hurricane Interface |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./etc/common/misc.py" |
# +-----------------------------------------------------------------+

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Universit 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,6 +16,7 @@
import sys
import math
import helpers
from helpers import irange
from helpers.io import ErrorMessage
from helpers.io import WarningMessage
@ -67,10 +68,9 @@ class Pattern ( object ):
byte = byte << 1
if line[i] != ' ': byte += 1
hexasLSB += [ hex(byte)[2:] ]
# Convert in MSB mode. Invert the bytes by pairs.
self._hexa = ''
for i in range(len(hexasLSB)/2):
for i in irange(len(hexasLSB)/2):
self._hexa += hexasLSB[i*2+1] + hexasLSB[i*2]
return self._hexa
@ -79,7 +79,7 @@ class Pattern ( object ):
side = math.sqrt(4*len(self._hexa))
if pow(side,2) != 4*len(self._hexa):
print '[ERROR] The pattern is not square (%d self._bits).' % (4*len(self._hexa))
print( '[ERROR] The pattern is not square ({} self._bits).'.format(4*len(self._hexa)))
return None
side /= 4
@ -154,17 +154,17 @@ def add ( **keywords ):
global LUT
try:
if not keywords.has_key('name'):
if not 'name' in keywords:
raise ErrorMessage(1,['patterns.add(): Malformed pattern, missing "name" argument.', str(keywords) ])
if keywords.has_key('bits') and keywords.has_key('hexa'):
if ('bits' in keywords) and ('hexa' in keywords):
w = WarningMessage( 'patterns.add(): Pattern "%s" has both bits & hexa, ignoring hexa.' % keywords['name'] )
print w
print( w )
del keywords['hexa']
LUT[ keywords['name'] ] = Pattern( **keywords )
except Exception, e:
except Exception as e:
helpers.io.catch( e )
return
@ -173,7 +173,7 @@ def add ( **keywords ):
def toHexa ( key ):
global LUT
if isinstance(key,int) or isinstance(key,long) or not LUT.has_key(key): return key
if isinstance(key,int) or not (key in LUT): return key
return LUT[key].hexa

View File

@ -16,7 +16,7 @@
import Cfg
import helpers.io
helpers.io.vprint( 1, ' o Loading "node180.scn6m_deep_09" technology.' )
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from Hurricane import DataBase
from CRL import System

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,26 +14,23 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import os
import os.path
from CRL import Environment
from CRL import AllianceFramework
allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'):
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if not allianceTop: allianceTop = '/soc/alliance'
cellsTop = allianceTop+'/cells'
af = AllianceFramework.get()
env = af.getEnvironment()
af = AllianceFramework.get()
env = af.getEnvironment()
env.setSCALE_X ( 100 )
env.setCATALOG ( 'CATAL' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
#import common.analog

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,16 +14,14 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.devices
from common.devices import addDevice
chamsDir = helpers.sysConfDir + '/share/coriolis2/'
spiceDir = chamsDir + 'spice/'
addDevice( name = 'DifferentialPairBulkConnected'
, spice = spiceDir+'DiffPairBulkConnected.spi'
, connectors = ( 'D1', 'D2', 'G1', 'G2', 'S' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,9 +14,8 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.display
common.display.createStyles( scale=0.5 )

View File

@ -9,7 +9,7 @@
# Used revision 8.00 of May 11, 2009.
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from Hurricane import DbU
from helpers.analogtechno import Length

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.etesian

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -15,7 +15,7 @@
import Cfg
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from Hurricane import DataBase
from CRL import AllianceFramework
@ -85,6 +85,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL1') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(2) # VIA side (that is VIA12).
, l(7) # obstacle dW.
) )
@ -97,6 +98,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL2') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(2) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )
@ -109,6 +111,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL3') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(2) # VIA side (that is VIA34).
, l(8) # obstacle dW.
) )
@ -121,6 +124,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL4') # meta
, l(0) # track offset from AB.
, l(15) # track pitch.
, l(6) # wire width.
, l(6) # perpandicular wire width.
, l(4) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )
@ -133,6 +137,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL5') # meta
, l(0) # track offset from AB.
, l(15) # track pitch.
, l(6) # wire width.
, l(6) # perpandicular wire width.
, l(4) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )
@ -145,6 +150,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL6') # meta
, l(0) # track offset from AB.
, l(15) # track pitch.
, l(6) # wire width.
, l(6) # perpandicular wire width.
, l(4) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )
@ -161,6 +167,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL1') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(2) # VIA side (that is VIA12).
, l(7) # obstacle dW.
) )
@ -173,6 +180,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL2') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(2) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )
@ -185,6 +193,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL3') # meta
, l(0) # track offset from AB.
, l(8) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(2) # VIA side (that is VIA12).
, l(8) # obstacle dW.
) )
@ -197,6 +206,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL4') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandiuclar wire width.
, l(2) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )
@ -213,6 +223,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL1') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(3) # VIA side (that is VIA12).
, l(7) # obstacle dW.
) )
@ -225,6 +236,7 @@ rg.addLayerGauge( RoutingLayerGauge.create( tech.getLayer('METAL2') # meta
, l(0) # track offset from AB.
, l(10) # track pitch.
, l(3) # wire width.
, l(3) # perpandicular wire width.
, l(3) # VIA side (that is VIA23).
, l(8) # obstacle dW.
) )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.misc

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.patterns

View File

@ -15,7 +15,7 @@
import Cfg
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from helpers import l, u, n

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Universié 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -15,10 +15,9 @@
import Cfg
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.stratus1
Cfg.getParamString( "stratus1.format" ).setString( "vst" )
Cfg.getParamString( "stratus1.simulator" ).setString( "asimut" )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,19 +14,17 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
from helpers import l, u, n
from Hurricane import DbU
from Hurricane import DataBase
from Hurricane import Technology
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from helpers import l, u, n
from Hurricane import DbU
from Hurricane import DataBase
from Hurricane import Technology
tech = DataBase.getDB().getTechnology()
if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() )
print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else:
tech = Technology.create( DataBase.getDB(), 'scn6m_deep_09' )
tech = Technology.create( DataBase.getDB(), 'scn6m_deep_09' )
DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.005, DbU.UnitPowerMicro )
@ -34,7 +32,6 @@ DbU.setGridsPerLambda ( 18 )
DbU.setSymbolicSnapGridStep( DbU.fromLambda( 1.0) )
DbU.setPolygonStep ( DbU.fromGrid ( 9.0) )
import common
from common.technology import *

View File

@ -23,7 +23,7 @@ from CRL import AllianceFramework
allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'):
if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,7 +14,7 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from helpers import l, u, n
from Hurricane import DbU
@ -36,7 +36,7 @@ def setEnclosures ( layer, subLayer, enclosures ):
tech = DataBase.getDB().getTechnology()
if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() )
print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else:
tech = Technology.create( DataBase.getDB(), 'freepdk45' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,7 +14,7 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import os
import os.path
@ -23,21 +23,19 @@ from CRL import AllianceFramework
allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'):
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if not allianceTop: allianceTop = '/soc/alliance'
cellsTop = None
if os.environ.has_key('CELLS_TOP'):
cellsTop = os.environ['CELLS_TOP']
if not os.path.isdir(cellsTop):
cellsTop = None
if 'CELLS_TOP' in os.environ:
cellsTop = os.environ['CELLS_TOP']
if not os.path.isdir(cellsTop):
cellsTop = None
if not cellsTop:
cellsTop = allianceTop+'/cells'
cellsTop = allianceTop+'/cells'
af = AllianceFramework.get()
env = af.getEnvironment()

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,19 +14,19 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from helpers import l, u, n
from Hurricane import DbU
from Hurricane import DataBase
from Hurricane import Technology
from helpers import l, u, n
from Hurricane import DbU
from Hurricane import DataBase
from Hurricane import Technology
tech = DataBase.getDB().getTechnology()
if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() )
print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'format(tech.getName()) ))
else:
tech = Technology.create( DataBase.getDB(), 'phenitec06' )
tech = Technology.create( DataBase.getDB(), 'phenitec06' )
DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.002, DbU.UnitPowerMicro )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,23 +16,21 @@
import os
import os.path
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from CRL import Environment
from CRL import AllianceFramework
allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'):
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if not allianceTop: allianceTop = '/soc/alliance'
cellsTop = allianceTop+'/cells'
af = AllianceFramework.get()
env = af.getEnvironment()
af = AllianceFramework.get()
env = af.getEnvironment()
env.setSCALE_X ( 100 )
env.setCATALOG ( 'CATAL' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,7 +16,7 @@
from helpers import l, u, n
from helpers.io import WarningMessage
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from Hurricane import DbU
from Hurricane import DataBase
@ -25,9 +25,9 @@ from Hurricane import Technology
tech = DataBase.getDB().getTechnology()
if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() )
print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else:
tech = Technology.create( DataBase.getDB(), 'cmos' )
tech = Technology.create( DataBase.getDB(), 'cmos' )
DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.5, DbU.UnitPowerMicro )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) orbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,24 +16,21 @@
import os
import os.path
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
from CRL import Environment
from CRL import AllianceFramework
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from CRL import Environment
from CRL import AllianceFramework
allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'):
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None
if not allianceTop: allianceTop = '/soc/alliance'
cellsTop = allianceTop+'/cells'
af = AllianceFramework.get()
env = af.getEnvironment()
af = AllianceFramework.get()
env = af.getEnvironment()
env.setSCALE_X ( 100 )
env.setCATALOG ( 'CATAL' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2019-2019, All Rights Reserved
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,7 +14,7 @@
import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
from helpers import l, u, n
from Hurricane import DbU
@ -24,9 +24,9 @@ from Hurricane import Technology
tech = DataBase.getDB().getTechnology()
if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() )
print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else:
tech = Technology.create( DataBase.getDB(), 'cmos45' )
tech = Technology.create( DataBase.getDB(), 'cmos45' )
DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.0025, DbU.UnitPowerMicro )

View File

@ -1,7 +1,7 @@
install( FILES helpers/__init__.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers )
install( FILES helpers/io.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers )
install( FILES helpers/utils.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers )
install( FILES helpers/overlay.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers )
install( FILES helpers/analogtechno.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers )
install( FILES helpers/technology.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers )
install( FILES helpers/__init__.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/io.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/utils.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/overlay.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/analogtechno.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/technology.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )

View File

@ -1,7 +1,8 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2012-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -17,12 +18,11 @@
# rather than an ordinary directory, thus enabling the uses of the
# 'dot' notation in import.
#print 'helpers.__init__()'
import sys
import os
import os.path
import re
import math
import traceback
quiet = False
@ -45,13 +45,23 @@ import CRL
import helpers.io
def irange ( value ):
if isinstance(value,int): return range(value)
if isinstance(value,float):
r,i = math.modf( value )
if r != 0.0:
print( '[WARNING] helpers.irange(): value={} is not an integer (truncated).'\
.format(value) )
return range(int( value ))
def stype ( o ): return str(type(o)).split("'")[1]
def isderived ( derived, base ):
btype = base.mro()[0]
for dtype in derived.mro():
if dtype == btype: return True
if dtype == btype: return True
return False
@ -60,20 +70,15 @@ def truncPath ( path, maxlength=80 ):
components = path.split(os.sep)
trunc = ''
for i in range(-1,-len(components),-1):
if len(trunc)+len(components[i]) >= maxlength: break
if not len(trunc): trunc = components[i]
else: trunc = os.path.join( components[i], trunc )
if len(trunc)+len(components[i]) >= maxlength: break
if not len(trunc): trunc = components[i]
else: trunc = os.path.join( components[i], trunc )
return '...' + os.sep + trunc
def textStackTrace ( trace, showIndent=True, scriptPath=None ):
#for entry in traceback.format_list( trace ):
# print entry,
indent = ''
if showIndent: indent = ' '
s = ''
if scriptPath:
if len(scriptPath) > 100:
@ -82,7 +87,7 @@ def textStackTrace ( trace, showIndent=True, scriptPath=None ):
if showIndent: s += '[ERROR] '
s += 'An exception occured while loading the Python script module:\n'
s += indent + '\"%s\"\n' % (filename)
s += indent + '\"{}\"\n' % (filename)
s += indent + 'You should check for simple python errors in this module.\n\n'
s += indent + 'Python stack trace:\n'
@ -92,13 +97,13 @@ def textStackTrace ( trace, showIndent=True, scriptPath=None ):
if len(filename) > 58:
filename = filename[-58:]
filename = '.../' + filename[ filename.find('/')+1 : ]
#s += indent + '[%02d] %45s:%-5d in \"%s()\"' % ( maxdepth-depth-1, filename, line, function )
s += indent + '#%d in %25s() at %s:%d\n' % ( depth, function, filename, line )
#s += indent + '[%02d] %45s:%-5d in \"{}()\"' % ( maxdepth-depth-1, filename, line, function )
s += indent + '#{} in {:>25}() at {}:{}\n'.format( depth, function, filename, line )
return s
def showStackTrace ( trace ):
print textStackTrace( trace, True )
print( textStackTrace( trace, True ))
return
@ -111,24 +116,24 @@ def textPythonTrace ( scriptPath=None, e=None, tryContinue=True ):
else:
filename = scriptPath
s += '[ERROR] An exception occured while loading the Python script module:\n'
s += ' \"%s\"\n' % (filename)
s += ' \"{}\"\n'.format(filename)
s += ' You should check for simple python errors in this module.\n'
if isinstance(e,helpers.io.ErrorMessage): trace = e.trace
else: trace = traceback.extract_tb( sys.exc_info()[2] )
s += textStackTrace( trace )
if e:
s += ' Error was:\n'
s += ' %s\n' % e
if isinstance(e,helpers.io.ErrorMessage):
trace = e.trace
s += textStackTrace( trace )
if e:
s += ' Error was:\n'
s += ' {}\n'.format(e)
else:
#trace = traceback.extract_tb( sys.exc_info()[2] )
print( traceback.format_exc() )
if tryContinue:
s += ' Trying to continue anyway...'
return s
def showPythonTrace ( scriptPath=None, e=None, tryContinue=True ):
print textPythonTrace( scriptPath, e, tryContinue )
print( textPythonTrace( scriptPath, e, tryContinue ))
return
@ -145,7 +150,7 @@ class Dots ( object ):
sys.stdout.write(self._header)
else:
if not (self._count % self._width):
sys.stdout.write("\n%s"%self._header)
sys.stdout.write("\n{}".format(self._header))
sys.stdout.write(".")
sys.stdout.flush()
@ -216,10 +221,10 @@ class Trace ( object ):
sys.stderr.write( message[1:] )
else:
sys.stderr.write( message )
sys.stderr.flush()
for f in sflags[1]:
if f == '+': self._tab.inc()
if f == '-': self._tab.dec()
sys.stderr.flush()
return
@ -244,16 +249,13 @@ def dots ( ttyWidth, leftText, rightText ):
def overload ( defaultParameters, parameters ):
overloads = {}
overloadParameters = []
for parameter in parameters:
overloads[ parameter[0] ] = parameter
for parameter in defaultParameters:
if overloads.has_key(parameter[0]):
if parameter[0] in overloads:
overloadParameters.append( overloads[parameter[0]] )
else:
overloadParameters.append( parameter )
return tuple(overloadParameters)
@ -276,32 +278,28 @@ def initTechno ( argQuiet ):
global technoDir
global techno
quiet = argQuiet
quiet = argQuiet
technoFiles = [ sysConfDir+'/techno.conf' ]
if os.getenv('HOME'):
technoFiles += [ os.getenv('HOME')+'/.coriolis2/techno.py' ]
technoFiles += [ os.getcwd()+'/.coriolis2/techno.py' ]
technoFiles.reverse()
for technoFile in technoFiles:
if os.path.isfile(technoFile):
if not quiet: print ' - Loading \"%s\".' % truncPath(technoFile)
execfile(technoFile,moduleGlobals)
if not quiet: print( ' - Loading "{}".'.format( truncPath(technoFile) ))
exec(open( technoFile ).read()) # moduleGlobals
break
if moduleGlobals.has_key('technology'):
if 'technology' in moduleGlobals:
techno = technology
else:
print '[WARNING] The technology is not set. Using <%s>.' % techno
if moduleGlobals.has_key('NdaDirectory'):
print( '[WARNING] The technology is not set. Using "{}".'.format( techno ))
if 'NdaDirectory' in moduleGlobals:
ndaDir = NdaDirectory
ndaConfDir = os.path.join( NdaDirectory, 'etc/coriolis2' )
else:
ndaConfDir = sysConfDir
technoDir = os.path.join( ndaConfDir, techno )
if not quiet: print ' - Technology: %s.' % techno
if not quiet: print( ' - Technology: {}.'.format( techno ))
unitsLambda = True
@ -314,7 +312,7 @@ def setNdaTopDir ( ndaTopDirArg ):
global ndaTopDir
if not os.path.isdir(ndaTopDirArg):
print helpers.io.WarningMessage( 'helpers.setNdaTopDir(): Directory "%s" does not exists.' % ndaTopDirArg )
print( helpers.io.WarningMessage( 'helpers.setNdaTopDir(): Directory "{}" does not exists.'.format( ndaTopDirArg )))
else:
ndaTopDir = ndaTopDirArg
sys.path.append( os.path.join(ndaTopDir,'etc/coriolis2') )
@ -331,18 +329,14 @@ def staticInitialization ( quiet=False ):
global unitsLambda
if sysConfDir != None:
#if not quiet: print ' o helpers.staticInitialization() Already run, exit.'
return
reSysConfDir = re.compile(r'.*etc\/coriolis2')
if not quiet: print ' o Locating configuration directory:'
if not quiet: print( ' o Locating configuration directory:' )
for path in sys.path:
if reSysConfDir.match(path):
sysConfDir = path
if not quiet: print ' - "%s"' % sysConfDir
if not quiet: print( ' - "{}"'.format( sysConfDir ))
break
if not sysConfDir:
coriolisTop = os.getenv('CORIOLIS_TOP')
if coriolisTop == '/usr':
@ -352,8 +346,7 @@ def staticInitialization ( quiet=False ):
else:
raise ErrorMessage( 1, [ 'Cannot locate the directoty holding the configuration files.'
, 'The path is something ending by <.../etc/coriolis2>.'] )
if not quiet: print ' - "%s"' % sysConfDir
if not quiet: print( ' - "{}"'.format( sysConfDir ))
initTechno( quiet )
return
@ -362,18 +355,14 @@ def setSysConfDir ( quiet=False ):
global sysConfDir
if sysConfDir != None:
#if not quiet: print ' o helpers.staticInitialization() Already run, exit.'
return
reSysConfDir = re.compile(r'.*etc\/coriolis2')
if not quiet: print ' o Locating configuration directory:'
if not quiet: print( ' o Locating configuration directory:' )
for path in sys.path:
if reSysConfDir.match(path):
sysConfDir = path
if not quiet: print ' - "%s"' % sysConfDir
if not quiet: print( ' - "{}"'.format( sysConfDir ))
break
if not sysConfDir:
coriolisTop = os.getenv('CORIOLIS_TOP')
if coriolisTop == '/usr':
@ -383,8 +372,7 @@ def setSysConfDir ( quiet=False ):
else:
raise ErrorMessage( 1, [ 'Cannot locate the directoty holding the configuration files.'
, 'The path is something ending by <.../etc/coriolis2>.'] )
if not quiet: print ' - "%s"' % sysConfDir
if not quiet: print( ' - "{}"'.format( sysConfDir ))
sys.path.append( sysConfDir )
return
@ -415,40 +403,37 @@ setSysConfDir( False )
def unloadUserSettings ():
global confModules
print ' o Unloading Python user\'s modules.'
print( ' o Unloading Python user\'s modules.' )
for moduleName in confModules:
refcount = sys.getrefcount( sys.modules[moduleName] )
warning = ''
if refcount > 3:
warning = '(NOTE: More than 3 refcount %d)' % refcount
#print helpers.io.WarningMessage( [ 'Configuration module "%s" has more than 3 references (%d)".' \
# % (moduleName,refcount)
# , 'May be unable to unload it from the Python process.'
# ] )
print ' - %-34s %-35s' % ('"%s".'%moduleName, warning)
del sys.modules[ moduleName ]
refcount = sys.getrefcount( sys.modules[moduleName] )
warning = ''
if refcount > 3:
warning = '(NOTE: More than 3 refcount %d)' % refcount
#print( helpers.io.WarningMessage( [ 'Configuration module "{}" has more than 3 references ({})".' \
# .format(moduleName,refcount)
# , 'May be unable to unload it from the Python process.'
# ] ))
print( ' - {:-34} {:-35}'.format( '"{}".'.format(moduleName), warning ))
del sys.modules[ moduleName ]
confModules = set()
return
def loadUserSettings ():
rvalue = False
if os.path.isfile('./coriolis2/settings.py'):
if os.path.isfile('./coriolis2/__init__.py'):
sys.path.insert( 0, os.getcwd() )
import coriolis2.settings
rvalue = True
else:
print helpers.io.WarningMessage( [ 'User\'s settings directory "%s" exists, but do not contains "__init__.py".' % './coriolis2/'
, '(path:"%s")' % os.path.abspath(os.getcwd())
] )
print( helpers.io.WarningMessage( [ 'User\'s settings directory "{}" exists, but do not contains "__init__.py".'.format( './coriolis2/' )
, '(path:"{}")'.format( os.path.abspath(os.getcwd()) )
] ))
else:
import symbolic.cmos
tagConfModules()
return rvalue
@ -461,13 +446,9 @@ def tagConfModules ():
if not (moduleName in sysModules):
confModules.add( moduleName )
#print 'Configuration modules:'
#for moduleName in confModules:
# print '-', moduleName
def resetCoriolis ():
print ' o Full reset of Coriolis/Hurricane databases.'
print( ' o Full reset of Coriolis/Hurricane databases.' )
CRL.AllianceFramework.get().destroy()
Viewer.Graphics.get().clear()
Hurricane.DataBase.getDB().destroy()

View File

@ -1,7 +1,8 @@
# -*- Mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2015-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2015-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,7 +15,6 @@
# +-----------------------------------------------------------------+
from __future__ import print_function
import os
import os.path
import sys
@ -126,7 +126,7 @@ def _loadAnalogTechno ( techno, ruleTable ):
, 0 )
else:
rule.addValue( valueToDbU(entry[3], unit, entry[4]), 0 )
except Exception, e:
except Exception as e:
e = ErrorMessage( 1, e )
e.addMessage( 'In {}:<analogTechnologyTable> at index {}.'.format(technoFile,entryNo) )
print( str(e) )

View File

@ -1,7 +1,8 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2012-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -13,7 +14,6 @@
# | Python : "./crlcore/helpers/io.py" |
# +-----------------------------------------------------------------+
from __future__ import print_function
import sys
import os
import os.path
@ -37,7 +37,7 @@ try:
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QAction
from PyQt4.QtGui import QKeySequence
except Exception, e:
except Exception as e:
try:
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QSizePolicy
@ -56,7 +56,7 @@ except Exception, e:
from PyQt5.QtWidgets import QHBoxLayout
from PyQt5.QtWidgets import QAction
from PyQt5.QtGui import QKeySequence
except e:
except Exception:
print( '[ERROR] helpers.io, neither PyQt4 nor PyQt5 is available.' )
sys.exit( 1 )
import Cfg
@ -183,10 +183,9 @@ class ErrorMessage ( Exception ):
elif len(arguments) > 1:
sys.stdout.flush()
text = list(arguments)
if text:
self.errors = []
while len(text[0]) == 0: del text[0]
while len(text) == 0: del text[0]
lstrip = 0
if text[0].startswith('[ERROR]'): lstrip = 8
@ -203,7 +202,6 @@ class ErrorMessage ( Exception ):
def __str__ ( self ):
if not isinstance(self.errors,list):
return "[ERROR] %s" % self.errors
formatted = "\n"
for i in range(len(self.errors)):
if i == 0: formatted += "[ERROR] %s" % self.errors[i]
@ -213,7 +211,6 @@ class ErrorMessage ( Exception ):
def getLinesAsString ( self ):
if not isinstance(self.errors,list): return self.errors
lines = ''
for line in self.errors: lines += line + '\n'
return lines
@ -256,13 +253,10 @@ def catch ( errorObject ):
em = ErrorMessage( 2, errorObject )
em.trace = traceback.extract_tb( sys.exc_info()[2] )
#em.scriptPath = __file__
print( em )
print( helpers.textStackTrace( em.trace, True, em.scriptPath ) )
if Viewer.Graphics.get().isEnabled():
tryCont = ErrorWidget( em ).exec_()
if UpdateSession.getStackSize() > 0: UpdateSession.close()
return

View File

@ -1,7 +1,7 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2012-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -25,7 +25,6 @@ Contains:
* ``overlay.CfgCache`` : A cache for Cfg parameters.
"""
from __future__ import print_function
import Cfg
import Hurricane
@ -80,9 +79,6 @@ class Configuration:
Cfg.getParamEnumerate(attr).setInt( val )
else:
Cfg.getParamInt(attr).setInt( val )
elif isinstance(val, long):
p = Cfg.getParamInt( attr ) # all params have a type
p.setInt( val )
elif isinstance(val, float):
p = Cfg.getParamDouble( attr ).setDouble( val )
elif '%' in val:
@ -138,7 +134,6 @@ class CachedParameter ( object ):
if len(self.vEnum): p = Cfg.getParamEnumerate( self.path )
elif isinstance(self.v,bool ): p = Cfg.getParamBool ( self.path )
elif isinstance(self.v,int ): p = Cfg.getParamInt ( self.path )
elif isinstance(self.v,long ): p = Cfg.getParamInt ( self.path )
elif isinstance(self.v,float): p = Cfg.getParamDouble ( self.path )
else: p = Cfg.getParamString ( self.path )
if p.type == Cfg.Parameter.Type.Enumerate: p.setInt ( self.v )
@ -281,7 +276,7 @@ class CfgCache ( object ):
vEnum = None
if isinstance(v,list ): vRange = v; v = None
if isinstance(v,tuple): vEnum = v; v = None
if not self._rattr.has_key(attr):
if not attr in self._rattr:
self._rattr[ attr ] = CachedParameter( self._path+'.'+attr, v )
if vRange is not None: self._rattr[ attr ].vRange = vRange
elif vEnum is not None: self._rattr[ attr ].vEnum = vEnum
@ -292,7 +287,7 @@ class CfgCache ( object ):
Get an attribute, if it doesn't exists, then we are in an intermediate
level like ``katana``, so create a new sub CfgCache for that attribute.
"""
if not self._rattr.has_key(attr):
if not attr in self._rattr:
path = self._path+'.'+attr if len(self._path) else attr
self._rattr[attr] = CfgCache( path, self._priority )
if isinstance(self._rattr[attr],CachedParameter):
@ -300,7 +295,7 @@ class CfgCache ( object ):
return self._rattr[attr]
def _hasCachedParam ( self, elements ):
if not self._rattr.has_key(elements[0]):
if not elements[0] in self._rattr:
return False
if len(elements) == 1:
return True

View File

@ -1,7 +1,7 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -17,7 +17,6 @@
Some helpers to create or load a technology and it's libraries.
"""
from __future__ import print_function
from Hurricane import DataBase, Library, BasicLayer, Layer, ViaLayer

View File

@ -1,7 +1,7 @@
# -*- mode:Python -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -21,7 +21,6 @@ Miscellaeous utilities. Contains:
and methods.
"""
from __future__ import print_function
import types
import inspect
import functools
@ -82,15 +81,15 @@ def classdecorator ( cls ):
def isprop ( attr ): return isinstance( attr, property )
def wrappedSetattr ( self, attr, v ):
if attr != '_baseClass' and self._baseClass.__dict__.has_key(attr):
if attr != '_baseClass' and (attr in self._baseClass.__dict__):
self._baseClass.__setattr__( attr, v )
object.__setattr__( self, attr, v )
def wrappedGetattr ( self, attr ):
if attr == '_baseClass': return self.__dict__['_baseClass']
if self.__dict__.has_key(attr): return self.__dict__[attr]
if attr in self.__dict__: return self.__dict__[attr]
selfClass = type( self )
if selfClass.__dict__.has_key(attr):
if attr in selfClass.__dict__:
prop = selfClass.__dict__[attr]
if isprop(prop):
return prop.__get__(self)

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2015-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2015-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
@ -18,7 +18,7 @@
#include <algorithm>
#include <QFont>
#include <QApplication>
#include "vlsisapd/utilities/Path.h"
#include "hurricane/utilities/Path.h"
#include "hurricane/Error.h"
#include "hurricane/Cells.h"
#include "hurricane/Library.h"
@ -26,7 +26,7 @@
#include "crlcore/AllianceFramework.h"
#include "crlcore/Catalog.h"
#include "crlcore/AcmSigda.h"
#include "crlcore/Ispd05Bookshelf.h"
//#include "crlcore/Ispd05Bookshelf.h"
#include "crlcore/Blif.h"
#include "crlcore/Iccad04Lefdef.h"
#include "crlcore/CellsModel.h"
@ -94,11 +94,11 @@ namespace CRL {
, CellLoader::Importer
, Catalog::State::Logical
, std::bind( &AcmSigda::load, placeholders::_1 ) ) );
loaders->addLoader( new CellLoader("aux"
, "ISPD'05 (Bookshelf)"
, CellLoader::Importer
, Catalog::State::Logical|Catalog::State::Physical
, std::bind( &Ispd05::load, placeholders::_1 ) ) );
// loaders->addLoader( new CellLoader("aux"
// , "ISPD'05 (Bookshelf)"
// , CellLoader::Importer
// , Catalog::State::Logical|Catalog::State::Physical
// , std::bind( &Ispd05::load, placeholders::_1 ) ) );
loaders->addLoader( new CellLoader("blif"
, "BLIF (Yosys/ABC)"
, CellLoader::Importer|CellLoader::MultiCell

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2015-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2015-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
@ -14,12 +14,10 @@
// +-----------------------------------------------------------------+
#ifndef CRL_CELL_DATAS_H
#define CRL_CELL_DATAS_H
#pragma once
#include <set>
#include <vector>
#include "vlsisapd/utilities/Path.h"
#include "hurricane/utilities/Path.h"
#include "crlcore/Catalog.h"
namespace Hurricane {
class Cell;
@ -187,5 +185,3 @@ namespace CRL {
}
#endif // CRL_CELL_DATAS_H

View File

@ -14,7 +14,7 @@
// +-----------------------------------------------------------------+
#include <unistd.h>
#include "vlsisapd/utilities/Path.h"
#include "hurricane/utilities/Path.h"
#include "hurricane/Initializer.h"
#include "hurricane/Warning.h"
#include "hurricane/DataBase.h"

View File

@ -29,16 +29,14 @@
${CRLCORE_SOURCE_DIR}/src/ccore/liberty
${CRLCORE_SOURCE_DIR}/src/ccore/toolbox
${HURRICANE_INCLUDE_DIR}
${CIF_INCLUDE_DIR}
${CONFIGURATION_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${Python_INCLUDE_DIRS}
${Boost_INCLUDE_DIR}
${QtX_INCLUDE_DIR}
)
add_definitions ( -DCORIOLIS_TOP="${CORIOLIS_TOP}"
-DSYS_CONF_DIR="${SYS_CONF_DIR}"
-DPYTHON_SITE_PACKAGES="${PYTHON_SITE_PACKAGES}"
-DPYTHON_SITE_PACKAGES="${Python_CORIOLISLIB}"
)
set ( includes crlcore/Utilities.h
@ -49,7 +47,6 @@
crlcore/GdsDriver.h
crlcore/OAParser.h
crlcore/OADriver.h
crlcore/CifDriver.h
crlcore/SearchPath.h
crlcore/Environment.h
crlcore/Catalog.h
@ -64,8 +61,8 @@
crlcore/Blif.h
crlcore/AcmSigda.h
crlcore/Iccad04Lefdef.h
crlcore/Ispd04Bookshelf.h
crlcore/Ispd05Bookshelf.h
# crlcore/Ispd04Bookshelf.h
# crlcore/Ispd05Bookshelf.h
crlcore/Ioc.h
crlcore/VhdlBit.h
crlcore/VhdlSignal.h
@ -92,7 +89,6 @@
COptions.cpp
Histogram.cpp
OAParserDriver.cpp
CifDriver.cpp
SearchPath.cpp
Environment.cpp
Catalog.cpp
@ -119,8 +115,6 @@
set ( gds_cpps gds/GdsDriver.cpp
gds/GdsParser.cpp
)
set ( cif_cpps cif/CifDriver.cpp
)
set ( toolbox_cpps toolbox/HyperNetPortOccurrences.cpp
toolbox/ToolBox.cpp
toolbox/UniqueCellOccurrences.cpp
@ -155,8 +149,8 @@
lefdef/LefDefExtension.cpp
)
set ( iccad04_cpps iccad04/Iccad04Lefdef.cpp )
set ( ispd04_cpps ispd04/Ispd04Bookshelf.cpp )
set ( ispd05_cpps ispd05/Ispd05Bookshelf.cpp )
# set ( ispd04_cpps ispd04/Ispd04Bookshelf.cpp )
# set ( ispd05_cpps ispd05/Ispd05Bookshelf.cpp )
set ( blif_cpps blif/BlifParser.cpp )
if ( LEFDEF_FOUND )
include_directories ( ${LEFDEF_INCLUDE_DIR} )
@ -302,14 +296,11 @@
${openaccess_cpps}
)
set_target_properties ( crlcore PROPERTIES VERSION 1.0 SOVERSION 1 )
target_link_libraries ( crlcore ${HURRICANE_PYTHON_LIBRARIES}
target_link_libraries ( crlcore ${HURRICANE_PYTHON_NEW_LIBRARIES}
${HURRICANE_PYTHON_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${HURRICANE_LIBRARIES}
${BOOKSHELF_LIBRARY}
${CONFIGURATION_LIBRARY}
${CIF_LIBRARY}
${AGDS_LIBRARY}
${UTILITIES_LIBRARY}
${LEFDEF_LIBRARIES}
${OA_LIBRARIES}
${QtX_LIBRARIES}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Universite 2008-2019, All Rights Reserved
// Copyright (c) Sorbonne Universite 2008-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
@ -18,7 +18,7 @@
#include <sstream>
#include <fstream>
#include <iomanip>
#include "vlsisapd/utilities/Path.h"
#include "hurricane/utilities/Path.h"
#include "crlcore/Histogram.h"

View File

@ -1,14 +1,14 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | Alliance / Hurricane Interface |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./Utilities.cpp" |
// +-----------------------------------------------------------------+
@ -23,8 +23,8 @@
#include <boost/program_options.hpp>
namespace boptions = boost::program_options;
#include "vlsisapd/utilities/Path.h"
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/utilities/Path.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Backtrace.h"
#include "hurricane/Warning.h"
#include "hurricane/viewer/Script.h"

View File

@ -187,24 +187,28 @@ namespace Vhdl {
else if (rightpar + 1 != name.size())
error = "malformed net name, right parenthesis is *not* the last character";
else {
size_t endindex = 0;
int value = stoi( name.substr(leftpar+1), &endindex );
if (endindex != rightpar-leftpar-1)
error = "unable to convert index (not a number)";
else if (value < 0)
error = "negative index";
else {
stem = name.substr( 0, leftpar );
index = (size_t)value;
return true;
try {
size_t endindex = 0;
int value = stoi( name.substr(leftpar+1), &endindex );
if (endindex != rightpar-leftpar-1)
error = "unable to convert index (not a number)";
else if (value < 0)
error = "negative index";
else {
stem = name.substr( 0, leftpar );
index = (size_t)value;
return true;
}
} catch ( exception& e ) {
error = e.what();
}
}
}
if (not error.empty()) {
cerr << Warning( "Entity::parseVector() Net has not a valid VHDL name, %s.\n"
" %s\n"
" \"%s\"\n"
, error.c_str()
, getString(net->getName()).c_str()
) << endl;

View File

@ -24,7 +24,7 @@
#include <vector>
using namespace std;
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h"
#include "hurricane/Plug.h"
#include "hurricane/Net.h"

View File

@ -1,28 +1,26 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2008-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | Alliance / Hurricane Interface |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./crlcore/Utilities.h" |
// +-----------------------------------------------------------------+
#ifndef CRL_UTILITIES_H
#define CRL_UTILITIES_H
#pragma once
#include <cstdarg>
#include <cstdio>
#include <ostream>
#include <iostream>
#include <string>
#include "vlsisapd/utilities/Path.h"
#include "hurricane/utilities/Path.h"
#include "hurricane/Commons.h"
#include "hurricane/Error.h"
#include "hurricane/Slot.h"
@ -464,6 +462,3 @@ class Dots {
const std::string _left;
const std::string _right;
};
#endif // CRL_UTILITIES

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2018-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2018-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
@ -27,7 +27,7 @@
#include <vector>
using namespace std;
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h"
#include "hurricane/DataBase.h"
#include "hurricane/BasicLayer.h"

View File

@ -1,14 +1,14 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2018-2018, All Rights Reserved
// Copyright (c) Sorbonne Université 2018-2021, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | G D S I I / Hurricane Interface |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./gds/GdsParser.cpp" |
// +-----------------------------------------------------------------+
@ -26,7 +26,7 @@
#include <vector>
using namespace std;
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/DebugSession.h"
#include "hurricane/Warning.h"
#include "hurricane/DataBase.h"

View File

@ -22,7 +22,7 @@
#if defined(HAVE_LEFDEF)
# include "lefrReader.hpp"
#endif
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Error.h"
#include "hurricane/Warning.h"
#include "hurricane/DataBase.h"
@ -446,7 +446,7 @@ namespace {
, parser->fromUnitsMicrons( r->yh )
);
}
//cerr << " | " << segment << endl;
cdebug_log(100,0) << "| " << segment << endl;
}
}

View File

@ -28,7 +28,7 @@
#include <vector>
using namespace std;
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h"
#include "hurricane/DataBase.h"
#include "hurricane/BasicLayer.h"

View File

@ -26,7 +26,7 @@
#include <vector>
using namespace std;
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/configuration/Configuration.h"
#include "hurricane/DebugSession.h"
#include "hurricane/UpdateSession.h"
#include "hurricane/Warning.h"

View File

@ -22,19 +22,16 @@
add_executable ( cyclop ${cpps} ${moccpps} )
target_link_libraries ( cyclop crlcore
${HURRICANE_PYTHON_NEW_LIBRARIES}
${HURRICANE_PYTHON_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${HURRICANE_LIBRARIES}
${BOOKSHELF_LIBRARY}
${AGDS_LIBRARY}
${CIF_LIBRARY}
${CONFIGURATION_LIBRARY}
${UTILITIES_LIBRARY}
${LEFDEF_LIBRARIES}
${OA_LIBRARIES}
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${PYTHON_LIBRARIES}
${Python_LIBRARIES}
-lutil
${LIBXML2_LIBRARIES}
${LIBEXECINFO_LIBRARIES}

View File

@ -29,7 +29,7 @@ namespace boptions = boost::program_options;
# include <QGtkStyle>
#endif
#include "vlsisapd/utilities/Path.h"
#include "hurricane/utilities/Path.h"
#include "hurricane/DataBase.h"
#include "hurricane/Technology.h"
#include "hurricane/Layer.h"

View File

@ -17,7 +17,7 @@
${HURRICANE_INCLUDE_DIR}
${CIF_INCLUDE_DIR}
${CONFIGURATION_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${Python_INCLUDE_DIRS}
${Boost_INCLUDE_DIR}
)
@ -43,7 +43,7 @@
PyToolEngineCollection.cpp
PyGraphicToolEngine.cpp
PyAcmSigda.cpp
PyIspd05.cpp
#PyIspd05.cpp
PySpice.cpp
PyBlif.cpp
PyGds.cpp
@ -65,7 +65,7 @@
crlcore/PyToolEngineCollection.h
crlcore/PyGraphicToolEngine.h
crlcore/PyAcmSigda.h
crlcore/PyIspd05.h
#crlcore/PyIspd05.h
crlcore/PySpice.h
crlcore/PyBlif.h
crlcore/PyGds.h

View File

@ -77,7 +77,7 @@ extern "C" {
HTRY
PyObject* arg0;
if (ParseOneArg("AllianceFramework.create()", args, INT_ARG, &arg0)) {
flags = PyInt_AsUnsignedLongMask(arg0);
flags = PyLong_AsUnsignedLongMask(arg0);
}
af = AllianceFramework::create( flags );
HCATCH
@ -230,6 +230,8 @@ extern "C" {
if ( not ParseTwoArg ( "AllianceFramework.saveCell", args, CELL_INT_ARG, &arg0, &arg1) ) return NULL;
//if (PyAny_AsLong(arg1) & CRL::Catalog::State::Logical)
// cerr << "saveSell() " << PYCELL_O(arg0) << " Logical set" << endl;
af->saveCell ( PYCELL_O(arg0),PyAny_AsLong(arg1) );
HCATCH

View File

@ -31,7 +31,7 @@
#include "crlcore/PyToolEngine.h"
#include "crlcore/PyToolEngineCollection.h"
#include "crlcore/PyAcmSigda.h"
#include "crlcore/PyIspd05.h"
// #include "crlcore/PyIspd05.h"
#include "crlcore/PySpice.h"
#include "crlcore/PyBlif.h"
#include "crlcore/PyGds.h"
@ -103,13 +103,28 @@ extern "C" {
};
static PyModuleDef PyCRL_ModuleDef =
{ PyModuleDef_HEAD_INIT
, "CRL" /* m_name */
, "Coriolis Core I/O framework"
/* m_doc */
, -1 /* m_size */
, PyCRL_Methods /* m_methods */
, NULL /* m_reload */
, NULL /* m_traverse */
, NULL /* m_clear */
, NULL /* m_free */
};
// ---------------------------------------------------------------
// Module Initialization : "initCRL ()"
DL_EXPORT(void) initCRL () {
cdebug_log(30,0) << "initCRL()" << endl;
PyMODINIT_FUNC PyInit_CRL ( void )
{
cdebug_log(30,0) << "PyInit_CRL()" << endl;
PySystem_LinkPyType ();
PyBanner_LinkPyType ();
@ -125,7 +140,7 @@ extern "C" {
PyToolEngine_LinkPyType ();
PyToolEngineCollection_LinkPyType ();
PyAcmSigda_LinkPyType ();
PyIspd05_LinkPyType ();
// PyIspd05_LinkPyType ();
PySpice_LinkPyType ();
PyBlif_LinkPyType ();
PyGds_LinkPyType ();
@ -148,7 +163,7 @@ extern "C" {
PYTYPE_READY ( ToolEngineCollection );
PYTYPE_READY ( ToolEngineCollectionLocator );
PYTYPE_READY ( AcmSigda );
PYTYPE_READY ( Ispd05 );
// PYTYPE_READY ( Ispd05 );
PYTYPE_READY ( Spice );
PYTYPE_READY ( Blif );
PYTYPE_READY ( Gds );
@ -165,11 +180,11 @@ extern "C" {
__cs.addType ( "alcCatalog" , &PyTypeCatalog , "<Catalog>" , false );
__cs.addType ( "alcCatStat" , &PyTypeCatalogState , "<Catalog::State>" , false );
PyObject* module = Py_InitModule ( "CRL", PyCRL_Methods );
if ( module == NULL ) {
PyObject* module = PyModule_Create( &PyCRL_ModuleDef );
if (module == NULL) {
cerr << "[ERROR]\n"
<< " Failed to initialize CRL module." << endl;
return;
return NULL;
}
Py_INCREF ( &PyTypeSystem );
@ -202,8 +217,8 @@ extern "C" {
PyModule_AddObject ( module, "ToolEngineCollectionLocator", (PyObject*)&PyTypeToolEngineCollectionLocator );
Py_INCREF ( &PyTypeAcmSigda );
PyModule_AddObject ( module, "AcmSigda", (PyObject*)&PyTypeAcmSigda );
Py_INCREF ( &PyTypeIspd05 );
PyModule_AddObject ( module, "Ispd05", (PyObject*)&PyTypeIspd05 );
// Py_INCREF ( &PyTypeIspd05 );
// PyModule_AddObject ( module, "Ispd05", (PyObject*)&PyTypeIspd05 );
Py_INCREF ( &PyTypeSpice );
PyModule_AddObject ( module, "Spice", (PyObject*)&PyTypeSpice );
Py_INCREF ( &PyTypeBlif );
@ -226,6 +241,7 @@ extern "C" {
//DbULoadConstants ( dictionnary );
cdebug_log(30,0) << "CRL.so loaded " << (void*)&typeid(string) << endl;
return module;
}

View File

@ -147,12 +147,12 @@ extern "C" {
extern void PyCatalogState_LinkPyType() {
cdebug_log(30,0) << "PyCatalogState_LinkType()" << endl;
PyTypeCatalogState.tp_dealloc = (destructor) PyCatalogState_DeAlloc;
PyTypeCatalogState.tp_compare = (cmpfunc) PyCatalogState_Cmp;
PyTypeCatalogState.tp_repr = (reprfunc) PyCatalogState_Repr;
PyTypeCatalogState.tp_str = (reprfunc) PyCatalogState_Str;
PyTypeCatalogState.tp_hash = (hashfunc) PyCatalogState_Hash;
PyTypeCatalogState.tp_methods = PyCatalogState_Methods;
PyTypeCatalogState.tp_dealloc = (destructor) PyCatalogState_DeAlloc;
PyTypeCatalogState.tp_richcompare = (richcmpfunc)PyCatalogState_Cmp;
PyTypeCatalogState.tp_repr = (reprfunc) PyCatalogState_Repr;
PyTypeCatalogState.tp_str = (reprfunc) PyCatalogState_Str;
PyTypeCatalogState.tp_hash = (hashfunc) PyCatalogState_Hash;
PyTypeCatalogState.tp_methods = PyCatalogState_Methods;
}

View File

@ -74,20 +74,36 @@ extern "C" {
};
DL_EXPORT(void) initConstant () {
cdebug_log(30,0) << "initConstant()" << endl;
static PyModuleDef PyConstant_ModuleDef =
{ PyModuleDef_HEAD_INIT
, "Constant" /* m_name */
, "Constants values used througout Coriolis."
/* m_doc */
, -1 /* m_size */
, PyConstant_Methods /* m_methods */
, NULL /* m_reload */
, NULL /* m_traverse */
, NULL /* m_clear */
, NULL /* m_free */
};
PyObject* module = Py_InitModule( "Constant", PyConstant_Methods );
PyMODINIT_FUNC PyInit_Constant ( void )
{
cdebug_log(30,0) << "PyInit_Constant()" << endl;
PyObject* module = PyModule_Create( &PyConstant_ModuleDef );
if (module == NULL) {
cerr << "[ERROR]\n"
<< " Failed to initialize Constant module." << endl;
return;
return NULL;
}
PyObject* dictionnary = PyModule_GetDict( module );
LoadConstants( dictionnary );
cdebug_log(30,0) << "Constant.so loaded " << (void*)&typeid(string) << endl;
return module;
}

View File

@ -544,6 +544,8 @@ extern "C" {
, "Return the default wire width of the given layer." }
, { "getViaWidth" , (PyCFunction)PyRoutingGauge_getViaWidth , METH_VARARGS
, "Return the default via width of the given layer." }
, { "getPWireWidth" , (PyCFunction)PyRoutingGauge_getPWireWidth , METH_VARARGS
, "Return the default perpandicular wire width of the given layer." }
, { "getPowerSupplyGauge" , (PyCFunction)PyRoutingGauge_getPowerSupplyGauge, METH_NOARGS
, "Return the power supply gauge (None if there isn't)." }
, { "getLayerGauge" , (PyCFunction)PyRoutingGauge_getLayerGauge , METH_VARARGS

View File

@ -13,6 +13,7 @@
add_executable ( cx2y ${cpps} )
target_link_libraries ( cx2y crlcore
${UTILITIES_LIBRARY}
${Python_LIBRARIES}
${LIBEXECINFO_LIBRARIES}
${LIBBFD_LIBRARIES}
)

View File

@ -14,9 +14,8 @@
set_cmake_policies()
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
find_package(PythonLibs 2 REQUIRED)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)

View File

@ -360,7 +360,7 @@ def staticInitialization ():
try:
print ' o Running configuration hook: Alliance.staticInitialization().'
print ' - Loading \"%s\".' % helpers.truncPath(confFile)
execfile( confFile, moduleGlobals )
exec( open(confFile).read() ) #, moduleGlobals )
except Exception, e:
print '[ERROR] An exception occured while loading the configuration file:'
print ' <%s>\n' % (confFile)

View File

@ -80,14 +80,14 @@
${CMAKE_CURRENT_SOURCE_DIR}/plugins/alpha/macro/macro.py
)
install ( FILES ${pySources} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus )
install ( FILES ${pyPlugins} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins )
install ( FILES ${pyPluginCTS} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/cts )
install ( FILES ${pyPluginC2C} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/core2chip )
install ( FILES ${pyPluginChip} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/chip )
install ( FILES ${pyPluginAlpha} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/alpha )
install ( FILES ${pyPluginAlphaBlock} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/alpha/block )
install ( FILES ${pyPluginAlphaC2C} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/alpha/core2chip )
install ( FILES ${pyPluginAlphaChip} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/alpha/chip )
install ( FILES ${pyPluginAlphaMacro} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus/plugins/alpha/macro )
install ( FILES ${pySources} DESTINATION ${Python_CORIOLISLIB}/cumulus )
install ( FILES ${pyPlugins} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins )
install ( FILES ${pyPluginCTS} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/cts )
install ( FILES ${pyPluginC2C} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/core2chip )
install ( FILES ${pyPluginChip} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/chip )
install ( FILES ${pyPluginAlpha} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/alpha )
install ( FILES ${pyPluginAlphaBlock} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/alpha/block )
install ( FILES ${pyPluginAlphaC2C} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/alpha/core2chip )
install ( FILES ${pyPluginAlphaChip} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/alpha/chip )
install ( FILES ${pyPluginAlphaMacro} DESTINATION ${Python_CORIOLISLIB}/cumulus/plugins/alpha/macro )
install ( PROGRAMS ${pyTools} DESTINATION bin )

View File

@ -186,7 +186,7 @@ def pyAlimVerticalRail ( cell, xcoord ) :
# Check the value of x
nb_col = cell.getAbutmentBox().getWidth() / DbU_lambda(PITCH)
if ( xcoord >= nb_col ) or ( xcoord < 0 ) :
print 'This is it'
print( 'This is it' )
message = "AlimVerticalRail : Illegal argument x , x must be between %d and %d\n" % ( 0, nb_col )
raise ErrorMessage(2,message)
@ -926,7 +926,7 @@ def pyPowerRing ( cell, core, n ) :
topRoutingLayer = db.getTechnology().getLayer( topRoutingLayerName )
allowedDepth = CRL.AllianceFramework.get().getRoutingGauge().getLayerDepth( topRoutingLayer )
print 'topRoutingLayer: <%s> depth:%d' % (topRoutingLayer.getName(), allowedDepth)
print( 'topRoutingLayer: <%s> depth:%d' % (topRoutingLayer.getName(), allowedDepth) )
UpdateSession.open()
@ -1576,7 +1576,7 @@ def pyPowerRing ( cell, core, n ) :
# end of while
# end of while
#print "\n\n\n\npoints_0 : ", points_0 , "\n\npoints_1 : " ,points_1 , "\n\npoints_2 : " ,points_2 , "\n\npoints_3 : " , points_3 , "\n\n\n\n"
#print( "\n\n\n\npoints_0 : ", points_0 , "\n\npoints_1 : " ,points_1 , "\n\npoints_2 : " ,points_2 , "\n\npoints_3 : " , points_3 , "\n\n\n\n" )
# Placer au cote du nord
for ins_pad in pad_north :
@ -1976,16 +1976,16 @@ def isExternalClockPad ( ins ) :
def affichePad ( cell ) :
global pad_north, pad_south, pad_east, pad_west
print "Pads in the north are :"
print( "Pads in the north are :" )
for pad in pad_north : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
print "Pads in the south are :"
print( "Pads in the south are :" )
for pad in pad_south : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
print "Pads in the east are :"
print( "Pads in the east are :" )
for pad in pad_east : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
print "Pads in the west are :"
print( "Pads in the west are :" )
for pad in pad_west : print cell.getInstance ( pad.getName() ).getMasterCell().getName()
############

View File

@ -1,7 +1,6 @@
# -*- explicit-buffer-name: "__init__.py<cumulus/plugins>" -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2014-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2014-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,6 +15,7 @@
import os
import sys
import traceback
import Cfg
import helpers
from helpers.io import vprint
@ -30,26 +30,22 @@ import CRL
from CRL import RoutingLayerGauge
NoFlags = 0000
ShowWarnings = 0001
WarningsAreErrors = 0002
NoFlags = 0
ShowWarnings = 1
WarningsAreErrors = 2
loaded = False
def kwParseMain ( **kw ):
def kwParseMain ( **kw ):
cell = None
if kw.has_key('cell') and kw['cell']:
if ('cell' in kw) and kw['cell']:
cell = kw['cell']
editor = None
if kw.has_key('editor') and kw['editor']:
if ('editor' in kw) and kw['editor']:
editor = kw['editor']
if cell == None: cell = editor.getCell()
#if cell == None:
# raise ErrorMessage( 3, 'Chip: No cell loaded yet.' )
return cell, editor
@ -66,8 +62,7 @@ def kwUnicornHook ( menuPath, menuName, menuTip, moduleFile, **kw ):
editor = kw['editor']
if moduleFile.endswith('.pyc') or moduleFile.endswith('.pyo'):
moduleFile = moduleFile[:-1]
if kw.has_key('beforeAction'):
if 'beforeAction' in kw:
editor.addToMenu( menuPath, menuName, menuTip, moduleFile, kw['beforeAction'] )
else:
editor.addToMenu( menuPath, menuName, menuTip, moduleFile )
@ -110,7 +105,7 @@ class CheckUnplaced ( object ):
error = ErrorMessage( 3, message )
if self.flags & WarningsAreErrors: raise error
else: print error
else: print( error )
return self.unplaceds
@ -137,7 +132,7 @@ class StackedVia ( object ):
def mergeDepth ( self, depth ):
if self._hasLayout:
print WarningMessage( 'StackedVia.mergeDepth(): Cannot be called *after* StackVia.doLayout()' )
print( WarningMessage( 'StackedVia.mergeDepth(): Cannot be called *after* StackVia.doLayout()' ))
return
if depth < self._bottomDepth: self._bottomDepth = depth
if depth > self._topDepth: self._topDepth = depth
@ -187,17 +182,32 @@ class StackedVia ( object ):
, 0 , 0
, self._width, self._height
) )
#print ' Sub-via: ', self._vias[-1]
#print( ' Sub-via: ', self._vias[-1] )
return
def loadPlugins ( pluginsDir ):
"""
Forced import of all the modules that resides in the directory ``pluginsDir``.
Works in three stages:
1. Build a list of all the ``.py`` files in the ``pluginsDir``, in case of
directories, import the whole package (it is assumed it *is* a Python
package directory).
2. Sort the list of modules to be loaded (alphabetical order).
This is an attempt to get the initialization done in deterministic order.
3. Import each module in order.
.. note:: Those modules will be searched later (in ``unicornInit.py``) for any
potential ``unicornHook()`` function.
"""
sys.path.append( pluginsDir )
sys.modules['plugins'].__path__.append( pluginsDir )
if not os.path.isdir(pluginsDir):
print ErrorMessage( 3, 'cumulus.__init__.py: Cannot find <cumulus/plugins> directory:' \
, '<%s>' % pluginsDir )
print( ErrorMessage( 3, 'cumulus.__init__.py: Cannot find <cumulus/plugins> directory:' \
, '"{}"'.format(pluginsDir) ))
return
moduleNames = []
@ -207,26 +217,24 @@ def loadPlugins ( pluginsDir ):
path = os.path.join(pluginsDir,entry)
if os.path.isdir(path):
packageName = "plugins." + entry
if not sys.modules.has_key(packageName):
if not packageName in sys.modules:
module = __import__( packageName, globals(), locals() )
else:
module = sys.modules[packageName]
module.__path__.append( path )
continue
moduleNames.append( entry[:-3] )
moduleNames.sort()
for moduleName in moduleNames:
try:
vprint( 2, ' - "%s"' % moduleName )
vprint( 2, ' - "{}"'.format(moduleName) )
module = __import__( moduleName, globals(), locals() )
except ErrorMessage, e:
print e
except ErrorMessage as e:
print( e )
helpers.showStackTrace( e.trace )
except Exception, e:
print e
except Exception as e:
print( e )
helpers.showPythonTrace( __file__, e )
return
@ -235,7 +243,6 @@ def loadPlugins ( pluginsDir ):
def staticInitialization ():
global loaded
if loaded: return
try:
vprint( 1, ' o Preload standard plugins.' )
pluginsDir = os.path.dirname(__file__)
@ -243,13 +250,14 @@ def staticInitialization ():
if helpers.ndaTopDir:
vprint( 1, ' o Preload NDA protected plugins.' )
pluginsDir = os.path.join( helpers.ndaTopDir, 'python2.7/site-packages/cumulus/plugins' )
pluginsDir = os.path.join( helpers.ndaTopDir, 'python{}.{}/site-packages/cumulus/plugins' \
.format( sys.version_info.major
, sys.version_info.minor ))
loadPlugins( pluginsDir )
else:
vprint( 1, ' o No NDA protected plugins.' )
except Exception, e:
except Exception as e:
helpers.showPythonTrace( __file__, e )
loaded = True
return

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2014-2018, All Rights Reserved
# Copyright (c) Sorbonne Université 2014-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -14,7 +13,6 @@
# +-----------------------------------------------------------------+
try:
import sys
import traceback
@ -48,14 +46,14 @@ try:
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QApplication
except:
print '[ERROR] AboutWindow: Neither PyQt4 nor PyQt5 is available.'
print( '[ERROR] AboutWindow: Neither PyQt4 nor PyQt5 is available.' )
sys.exit( 1 )
import Viewer
import helpers
from helpers.io import ErrorMessage
from helpers.io import WarningMessage
import plugins
except Exception, e:
except Exception as e:
helpers.io.catch( e )
sys.exit(2)
@ -154,16 +152,12 @@ def scriptMain ( **kw ):
rvalue = True
try:
#helpers.setTraceLevel( 550 )
aboutWidget = AboutWidget()
answer = aboutWidget.exec_()
print 'answer:', answer
print( 'answer:', answer )
if not answer: return True
except Exception, e:
except Exception as e:
helpers.io.catch( e )
sys.stdout.flush()
sys.stderr.flush()
return rvalue

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -13,7 +13,6 @@
# +-----------------------------------------------------------------+
from __future__ import print_function
import sys
import os.path
import Cfg
@ -182,11 +181,11 @@ class BigVia ( object ):
trace( 550, '\t| botEnclosure[{}]: {}\n'.format(depth,DbU.getValueString(botEnclosure)) )
trace( 550, '\t| enclosure [{}]: {}\n'.format(depth,DbU.getValueString(enclosure)) )
cutArea = self.plates[ depth ].getBoundingBox()
hEnclosure = enclosure + cutSide/2
hEnclosure = enclosure + cutSide//2
vEnclosure = hEnclosure
if hEnclosure*2 > cutArea.getWidth():
if self.flags & BigVia.AllowHorizontalExpand:
hEnclosure = cutArea.getWidth()/2
hEnclosure = cutArea.getWidth()//2
else:
raise ErrorMessage( 1, [ 'BigVia._doCutMatrix(): Cannot create cut of {} in {}.' \
.format( cutLayer.getName(), self )
@ -194,15 +193,15 @@ class BigVia ( object ):
] )
if vEnclosure*2 > cutArea.getHeight():
if self.flags & BigVia.AllowVerticalExpand:
vEnclosure = cutArea.getHeight()/2
vEnclosure = cutArea.getHeight()//2
else:
raise ErrorMessage( 1, [ 'BigVia._doCutMatrix(): Cannot create cut of {} in {}.' \
.format( cutLayer.getName(), self )
, 'Height is too small to fit a single VIA cut.'
] )
cutArea.inflate( -hEnclosure, -vEnclosure )
xoffset = (cutArea.getWidth () % (cutSide+cutSpacing)) / 2
yoffset = (cutArea.getHeight() % (cutSide+cutSpacing)) / 2
xoffset = (cutArea.getWidth () % (cutSide+cutSpacing)) // 2
yoffset = (cutArea.getHeight() % (cutSide+cutSpacing)) // 2
cutArea.translate( xoffset, yoffset )
self.vias[ depth ] = []
y = cutArea.getYMin()

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -13,7 +13,6 @@
# +-----------------------------------------------------------------+
from __future__ import print_function
import sys
import os.path
from copy import deepcopy
@ -122,12 +121,12 @@ class Side ( object ):
if flags & IoPin.A_BEGIN:
self.ubegin += ustep
pinOffset = self.ubegin
if not self.pins.has_key(self.ubegin):
if not self.ubegin in self.pins:
break
else:
self.uend -= ustep
pinOffset = self.uend
if not self.pins.has_key(self.uend):
if not self.uend in self.pins:
break
else:
pinOffset = upos
@ -148,7 +147,7 @@ class Side ( object ):
upos = pin.getY()
else:
upos = pin.getX()
if not self.pins.has_key(upos):
if not upos in self.pins:
self.pins[upos] = [ pin ]
else:
self.pins[upos].append( pin )
@ -194,7 +193,7 @@ class Side ( object ):
, pinPos.getX()
, pinPos.getY()
, gauge.getWireWidth()
, gauge.getWireWidth() / 2
, gauge.getWireWidth() // 2
)
NetExternalComponents.setExternal( pin )
self.append( pin )
@ -227,7 +226,7 @@ class Side ( object ):
, gauge.getLayer()
, pinPos.getX()
, pinPos.getY()
, gauge.getWireWidth() / 2
, gauge.getWireWidth() // 2
, gauge.getWireWidth()
)
NetExternalComponents.setExternal( pin )
@ -291,7 +290,7 @@ class Block ( object ):
@staticmethod
def lookup ( cell ):
if Block.LUT.has_key(cell): return Block.LUT[cell]
if cell in Block.LUT: return Block.LUT[cell]
return None
def __init__ ( self, conf ):
@ -834,6 +833,8 @@ class Block ( object ):
#if self.conf.useHFNS: self.findHfnTrees4()
self.initEtesian()
self.addHTrees()
sys.stdout.flush()
sys.stderr.flush()
#if self.conf.useHFNS: self.addHfnBuffers()
#if editor: editor.fit()
#Breakpoint.stop( 0, 'Clock tree(s) done.' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -12,7 +12,6 @@
# | Python : "./plugins/block/configuration.py" |
# +-----------------------------------------------------------------+
from __future__ import print_function
import sys
import re
import os.path
@ -288,7 +287,7 @@ class GaugeConf ( object ):
trace( 550, ',+', '\tGaugeConf.rpAccess() {}\n'.format(rp) )
startDepth = self.routingGauge.getLayerDepth( rp.getOccurrence().getEntity().getLayer() )
trace( 550, '\tlayer:{} startDepth:{}\n'.format(rp.getOccurrence().getEntity().getLayer(),startDepth) )
if self._rpToAccess.has_key(rp):
if rp in self._rpToAccess:
trace( 550, '-' )
return self._rpToAccess[rp]
if flags & GaugeConf.DeepDepth:
@ -302,7 +301,7 @@ class GaugeConf ( object ):
#hoffset = self._routingGauge.getLayerGauge(hdepth).getOffset()
#contact1 = Contact.create( rp, self._routingGauge.getContactLayer(0), 0, 0 )
#midSliceY = contact1.getY() - (contact1.getY() % self._cellGauge.getSliceHeight()) \
# + self._cellGauge.getSliceHeight() / 2
# + self._cellGauge.getSliceHeight() // 2
#midTrackY = midSliceY - ((midSliceY - hoffset) % hpitch)
#dy = midSliceY - contact1.getY()
#
@ -377,7 +376,7 @@ class GaugeConf ( object ):
def rpByOccurrence ( self, occurrence, net ):
plug = occurrence.getEntity()
if self._plugToRp.has_key(plug):
if plug in self._plugToRp:
rp = self._plugToRp[plug]
else:
rp = RoutingPad.create( net, occurrence, RoutingPad.BiggestArea )
@ -386,7 +385,7 @@ class GaugeConf ( object ):
def rpAccessByOccurrence ( self, occurrence, net, flags ):
plug = occurrence.getEntity()
if self._plugToRp.has_key(plug):
if plug in self._plugToRp:
rp = self._plugToRp[plug]
else:
rp = RoutingPad.create( net, occurrence, RoutingPad.BiggestArea )
@ -394,7 +393,7 @@ class GaugeConf ( object ):
return self.rpAccess( self.rpByOccurrence(occurrence,net), flags )
def rpByPlug ( self, plug, net ):
if self._plugToRp.has_key(plug):
if plug in self._plugToRp:
rp = self._plugToRp[plug]
else:
occurrence = Occurrence( plug, Path(net.getCell(),'') )
@ -473,7 +472,7 @@ class GaugeConf ( object ):
minArea = self._routingGauge.getRoutingLayer( depth ).getMinimalArea()
extension = 0
if minArea:
minLength = DbU.fromPhysical( minArea / DbU.toPhysical( wireWidth, DbU.UnitPowerMicro )
minLength = DbU.fromPhysical( minArea // DbU.toPhysical( wireWidth, DbU.UnitPowerMicro )
, DbU.UnitPowerMicro )
minLength = toFoundryGrid( minLength, DbU.SnapModeSuperior );
if isinstance(segment,Horizontal):
@ -481,7 +480,7 @@ class GaugeConf ( object ):
uMax = segment.getTarget().getX()
segLength = abs( uMax - uMin )
if segLength < minLength:
extension = toFoundryGrid( (minLength - segLength)/2, DbU.SnapModeSuperior )
extension = toFoundryGrid( (minLength - segLength)//2, DbU.SnapModeSuperior )
if uMin > uMax:
extension = - extension
segment.setDxSource( -extension )
@ -491,7 +490,7 @@ class GaugeConf ( object ):
uMax = segment.getTarget().getY()
segLength = abs( uMax - uMin )
if segLength < minLength:
extension = toFoundryGrid( (minLength - segLength)/2, DbU.SnapModeSuperior )
extension = toFoundryGrid( (minLength - segLength)//2, DbU.SnapModeSuperior )
if uMin > uMax:
extension = - extension
segment.setDySource( -extension )
@ -1033,7 +1032,7 @@ class IoPin ( object ):
# , pinPos.getX()
# , pinPos.getY()
# , gauge.getWireWidth()
# , gauge.getWireWidth() / 2
# , gauge.getWireWidth() // 2
# )
# NetExternalComponents.setExternal( pin )
# side.append( self.flags, pin )
@ -1061,7 +1060,7 @@ class IoPin ( object ):
# , gauge.getLayer()
# , pinPos.getX()
# , pinPos.getY()
# , gauge.getWireWidth() / 2
# , gauge.getWireWidth() // 2
# , gauge.getWireWidth()
# )
# NetExternalComponents.setExternal( pin )
@ -1200,12 +1199,12 @@ class BlockConf ( GaugeConf ):
self.deltaAb = [ dx1, dy1, dx2, dy2 ]
def incIoPinsCounts ( self, net ):
if not self.ioPinsCounts.has_key(net):
if not net in self.ioPinsCounts:
self.ioPinsCounts[net] = 0
self.ioPinsCounts[net] += 1
def getIoPinsCounts ( self, net ):
if not self.ioPinsCounts.has_key(net): return 0
if not net in self.ioPinsCounts: return 0
return self.ioPinsCounts[net]
def resetBufferCount ( self ):

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,7 +16,6 @@
Manage High Fanout Net Synthesis (HFNS).
"""
from __future__ import print_function
import sys
import os.path
import re
@ -121,11 +120,11 @@ class SlicedArea ( object ):
transf = instance.getTransformation()
occurrence.getPath().getTransformation().applyOn( transf )
transf.applyOn( ab )
y = (ab.getYMin() - cellAb.getYMin()) / sliceHeight
y = (ab.getYMin() - cellAb.getYMin()) // sliceHeight
if (ab.getYMin() - cellAb.getYMin()) % sliceHeight:
print( ErrorMessage( 1, 'SlicedArea.__init__(): Misaligned {}.'.format(occurrence) ))
continue
if not self.rows.has_key(y):
if not y in self.rows:
self.rows[y] = []
row = self.rows[ y ]
row.append( (occurrence,ab) )
@ -584,7 +583,7 @@ class BufferTree ( object ):
maxWL = timing.tech.getWlEstimate( self.bufName, clusterA.size+clusterB.size )
area = Box( clusterA.area )
area.merge( clusterB.area )
hpWL = (area.getWidth() + area.getHeight()) / 2
hpWL = (area.getWidth() + area.getHeight()) // 2
if hpWL >= maxWL:
return True
trace( 550, '\t> Reject merge: hpWL >= maxWL ({} >= {}).\n' \
@ -596,7 +595,7 @@ class BufferTree ( object ):
return False
area = Box( clusterA.area )
area.merge( clusterB.area )
hpwl = (area.getWidth() + area.getHeight()) / 2
hpwl = (area.getWidth() + area.getHeight()) // 2
if hpwl > 2*self.edgeLimit:
trace( 550, '\t> Reject merge, over HPWL threshold of 2*{}.\n' \
.format(DbU.getValueString(self.edgeLimit)))

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,7 +16,6 @@
Manage High Fanout Net Synthesis (HFNS).
"""
from __future__ import print_function
import sys
import os.path
import re

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -16,7 +16,6 @@
Manage High Fanout Net Synthesis (HFNS).
"""
from __future__ import print_function
import sys
import os.path
import re
@ -328,14 +327,14 @@ class Cluster ( object ):
graph.addNode( self
, driverCenter.getX()
, self.bufferTree.spares.toYGCellGrid(driverCenter.getY())
+ self.bufferTree.spares.conf.sliceHeight / 2
+ self.bufferTree.spares.conf.sliceHeight // 2
, rsmt.Node.Driver )
for anchor in self.mergedAnchors:
sinkCenter = anchor.bInputRp.getPosition()
graph.addNode( anchor
, sinkCenter.getX()
, self.bufferTree.spares.toYGCellGrid(sinkCenter.getY())
+ self.bufferTree.spares.conf.sliceHeight / 2 )
+ self.bufferTree.spares.conf.sliceHeight // 2 )
#graph.doIteratedOneSteiner()
graph.doFlute()
graph.createGRSegments()
@ -479,7 +478,7 @@ class BufferTree ( object ):
maxWL = timing.tech.getWlEstimate( self.bufName, clusterA.size+clusterB.size )
area = Box( clusterA.area )
area.merge( clusterB.area )
hpWL = (area.getWidth() + area.getHeight()) / 2
hpWL = (area.getWidth() + area.getHeight()) // 2
trace( 550, '\t> BufferTree.canMerge(): estimatedWL >= maxWL ({} >= {}).\n' \
.format(DbU.getValueString(estimatedWL),DbU.getValueString(maxWL)) )
if estimatedWL >= maxWL:
@ -493,7 +492,7 @@ class BufferTree ( object ):
return False
area = Box( clusterA.area )
area.merge( clusterB.area )
hpwl = (area.getWidth() + area.getHeight()) / 2
hpwl = (area.getWidth() + area.getHeight()) // 2
if hpwl > 2*self.edgeLimit:
trace( 550, '\t> Reject merge, over HPWL threshold of 2*{}.\n' \
.format(DbU.getValueString(self.edgeLimit)))

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -20,7 +20,6 @@ so each of them is under the fanout threshold. Basic method, do not
take into account the placement or the global wirelength.
"""
from __future__ import print_function
import sys
import os.path
import re

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software.
# Copyright (c) SU 2020-2020, All Rights Reserved
# Copyright (c) Sorbonne Université 2020-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
@ -13,7 +13,6 @@
# +-----------------------------------------------------------------+
from __future__ import print_function
import sys
import os.path
import Cfg
@ -248,11 +247,11 @@ class HTree ( object ):
else:
driverPlugs.append( plugOcc )
quadTree.rsplitNetlist()
if self.spares.conf.isCoreBlock:
plug = utils.getPlugByName( quadTree.buffers[0], bufferConf.input )
plug.setNet( self.treeNet )
trace( 550, '\tCore mode, setting only root plug "{}"\n'.format(self.treeNet.getName()) )
trace( 550, '\tPlug of "{}" (Cell:{})\n'.format(self.treeNet.getName()
,self.treeNet.getCell()) )
for plug in self.treeNet.getPlugs():
trace( 550, '\t| {}\n'.format(plug) )
#if self.spares.conf.isCoreBlock:
plug = utils.getPlugByName( quadTree.buffers[0], bufferConf.input )
plug.setNet( self.treeNet )
trace( 550, '\tCore mode, setting only root plug "{}"\n'.format(self.treeNet.getName()) )
trace( 550, '\tPlug of "{}" (Cell:{})\n'.format(self.treeNet.getName()
,self.treeNet.getCell()) )
for plug in self.treeNet.getPlugs():
trace( 550, '\t| {}\n'.format(plug) )

Some files were not shown because too many files have changed in this diff Show More