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_boost()
setup_qt() setup_qt()
find_package(PythonLibs 2 REQUIRED) find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED) find_package(PythonSitePackages REQUIRED)
find_package(FLUTE REQUIRED) find_package(FLUTE REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED) find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED) find_package(CORIOLIS REQUIRED)
find_package(ETESIAN REQUIRED) find_package(ETESIAN REQUIRED)

View File

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

View File

@ -17,7 +17,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <vector> #include <vector>
#include "vlsisapd/configuration/Configuration.h" #include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h" #include "hurricane/Warning.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
#include "hurricane/Technology.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 ()" // Module Initialization : "initAnabatic ()"
DL_EXPORT(void) initAnabatic () { PyMODINIT_FUNC PyInit_Anabatic ( void )
cdebug_log(32,0) << "initAnabatic()" << endl; {
cdebug_log(32,0) << "PyInit_Anabatic()" << endl;
PyObject* module = Py_InitModule( "Anabatic", PyAnabatic_Methods ); PyObject* module = PyModule_Create( &PyAnabatic_ModuleDef );
if (module == NULL) { if (module == NULL) {
cerr << "[ERROR]\n" cerr << "[ERROR]\n"
<< " Failed to initialize Anabatic module." << endl; << " Failed to initialize Anabatic module." << endl;
return; return NULL;
} }
PyObject* dictionnary = PyModule_GetDict(module); PyObject* dictionnary = PyModule_GetDict(module);
@ -77,6 +92,8 @@ extern "C" {
LoadObjectConstant( dictionnary,EngineLayerAssignByTrunk ,"EngineLayerAssignByTrunk" ); LoadObjectConstant( dictionnary,EngineLayerAssignByTrunk ,"EngineLayerAssignByTrunk" );
LoadObjectConstant( dictionnary,EngineLayerAssignNoGlobalM2V,"EngineLayerAssignNoGlobalM2V" ); LoadObjectConstant( dictionnary,EngineLayerAssignNoGlobalM2V,"EngineLayerAssignNoGlobalM2V" );
LoadObjectConstant( dictionnary,EngineNoNetLayerAssign ,"EngineNoNetLayerAssign" ); LoadObjectConstant( dictionnary,EngineNoNetLayerAssign ,"EngineNoNetLayerAssign" );
return module;
} }

View File

@ -5,12 +5,13 @@
cmake_minimum_required(VERSION 2.4.0) 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) add_subdirectory(cmake_modules)
list(INSERT CMAKE_MODULE_PATH 0 "${Bootstrap_SOURCE_DIR}/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) find_package(PythonSitePackages REQUIRED)
print_cmake_module_path() print_cmake_module_path()
@ -23,7 +24,7 @@
OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
install(DIRECTORY builder install(DIRECTORY builder
DESTINATION ${PYTHON_SITE_PACKAGES} ) DESTINATION ${Python_CORIOLISLIB} )
install(FILES ccb.py install(FILES ccb.py
DESTINATION bin DESTINATION bin

View File

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

View File

@ -2,98 +2,88 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/AboutWidget.py" | # | Python : "./builder/AboutWidget.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
from PyQt4.QtCore import Qt from PyQt4.QtCore import Qt
from PyQt4.QtGui import QPalette from PyQt4.QtGui import QPalette, QColor, QFont, QWidget, \
from PyQt4.QtGui import QColor QFrame, QLabel, QVBoxLayout, QAction, \
from PyQt4.QtGui import QFont QKeySequence, QApplication
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
class AboutWidget ( QWidget ): class AboutWidget ( QWidget ):
def __init__ ( self, parent=None ): def __init__ ( self, parent=None ):
QWidget.__init__ ( self, parent ) QWidget.__init__ ( self, parent )
self.setFixedSize( 500, 400 ) self.setFixedSize( 500, 400 )
self.setStyleSheet( 'background-color: #ffffdd;' ) self.setStyleSheet( 'background-color: #ffffdd;' )
topLine = QFrame() topLine = QFrame()
topLine.setFrameShape( QFrame.HLine ) topLine.setFrameShape( QFrame.HLine )
topLine.setLineWidth ( 2 ) topLine.setLineWidth ( 2 )
botLine = QFrame() botLine = QFrame()
botLine.setFrameShape( QFrame.HLine ) botLine.setFrameShape( QFrame.HLine )
botLine.setLineWidth ( 2 ) botLine.setLineWidth ( 2 )
title = QLabel( 'CCB' ) title = QLabel( 'CCB' )
title.setAlignment( Qt.AlignCenter ) title.setAlignment( Qt.AlignCenter )
font = title.font() font = title.font()
font.setPointSize( 72 ) font.setPointSize( 72 )
font.setWeight ( QFont.Bold ) font.setWeight ( QFont.Bold )
title.setFont( font ) title.setFont( font )
subTitle = QLabel( 'Coriolis & Chams Builder for the Dummies' ) subTitle = QLabel( 'Coriolis Toolchain Builder for the Dummies' )
subTitle.setAlignment( Qt.AlignCenter ) subTitle.setAlignment( Qt.AlignCenter )
subTitle.setFont( QFont('Courier',10,QFont.Bold) ) subTitle.setFont( QFont('Courier',10,QFont.Bold) )
authors = QLabel( 'Coriolis CAD System 3.0 . . . . . . . . ccb 1.0\n'
authors = QLabel( 'Coriolis CAD System 1.0 . . . . . . . . ccb 1.0\n' 'Copyright (c) 2008-2021 . . Sorbonne Universite\n'
'Copyright (c) 2008-2016 . . . . . . . . . . UPMC\n' 'Authors . . . . . . . . . . . . . Damien Dupuis\n'
'Authors . . . . . . . . . . . . . Damien Dupuis\n' ' . . . . . . . . . . . . Jean-Paul Chaput\n'
' . . . . . . . . . . . . Jean-Paul Chaput\n' 'E-Mail . . . . . . . . Jean-Paul.Chaput@lip6.fr'
'E-Mail . . . . . . . . Jean-Paul.Chaput@lip6.fr' )
) authors.setAlignment( Qt.AlignCenter )
authors.setAlignment( Qt.AlignCenter ) authors.setFont( QFont('Courier',10,QFont.Bold) )
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 )
self.setLayout( vLayout ) vLayout = QVBoxLayout()
vLayout.addStretch(10)
self._exitAction = QAction( '&Exit', self ) vLayout.addWidget( topLine )
self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' ) vLayout.addWidget( title )
self._exitAction.setShortcut ( QKeySequence('CTRL+Q') ) vLayout.addStretch(1)
self._exitAction.triggered.connect( QApplication.closeAllWindows ) vLayout.addWidget( subTitle )
self.addAction( self._exitAction ) vLayout.addWidget( authors )
vLayout.addStretch(1)
self._closeAction = QAction( '&Close', self ) vLayout.addWidget( botLine )
self._closeAction.setStatusTip( 'Close the About Window' ) vLayout.addStretch(10)
self._closeAction.setShortcut ( QKeySequence('CTRL+A') )
self._closeAction.triggered.connect( self.close )
self.addAction( self._closeAction )
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 -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/Builder.py" | # | Python : "./builder/Builder.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
@ -20,9 +20,9 @@ import os
import os.path import os.path
import datetime import datetime
import subprocess import subprocess
from . import ErrorMessage from . import ErrorMessage
from Project import Project from .Project import Project
from Configuration import Configuration from .Configuration import Configuration
class Builder: class Builder:
@ -51,14 +51,11 @@ class Builder:
self._environment = os.environ self._environment = os.environ
return return
def __setattr__ ( self, attribute, value ): def __setattr__ ( self, attribute, value ):
if attribute[0] == "_": if attribute[0] == "_":
self.__dict__[attribute] = value self.__dict__[attribute] = value
return return
if attribute in self._conf.getAllIds(): setattr( self._conf, attribute, value ) if attribute in self._conf.getAllIds(): setattr( self._conf, attribute, value )
if attribute == "quiet": self._quiet = value if attribute == "quiet": self._quiet = value
elif attribute == "rmBuild": self._rmBuild = value elif attribute == "rmBuild": self._rmBuild = value
elif attribute == "doBuild": self._doBuild = value elif attribute == "doBuild": self._doBuild = value
@ -84,18 +81,15 @@ class Builder:
elif attribute == "makeArguments": self._makeArguments = value.split () elif attribute == "makeArguments": self._makeArguments = value.split ()
return return
def __getattr__ ( self, attribute ): def __getattr__ ( self, attribute ):
if attribute[0] != "_": if attribute[0] != "_":
if attribute == 'conf': return self._conf if attribute == 'conf': return self._conf
if attribute in self._conf.getAllIds(): if attribute in self._conf.getAllIds():
return getattr( self._conf, attribute ) return getattr( self._conf, attribute )
if not attribute in self.__dict__:
if not self.__dict__.has_key(attribute):
raise ErrorMessage( 1, 'Builder has no attribute <%s>.'%attribute ) raise ErrorMessage( 1, 'Builder has no attribute <%s>.'%attribute )
return self.__dict__[attribute] return self.__dict__[attribute]
def _guessGitHash ( self, project ): def _guessGitHash ( self, project ):
self.gitHash = 'x' self.gitHash = 'x'
os.chdir ( self.sourceDir+'/'+project.getName() ) os.chdir ( self.sourceDir+'/'+project.getName() )
@ -103,58 +97,48 @@ class Builder:
self.gitHash = subprocess.Popen ( command, stdout=subprocess.PIPE ).stdout.readlines()[0] self.gitHash = subprocess.Popen ( command, stdout=subprocess.PIPE ).stdout.readlines()[0]
return return
def _configure ( self, fileIn, fileOut ): def _configure ( self, fileIn, fileOut ):
fdFileIn = open ( fileIn , "r" ) fdFileIn = open ( fileIn , "r" )
fdFileOut = open ( fileOut, "w" ) fdFileOut = open ( fileOut, "w" )
for line in fdFileIn.readlines(): for line in fdFileIn.readlines():
stable = False stable = False
substituted0 = line substituted0 = line
while not stable: while not stable:
substituted1 = re.sub ( r"@revdate@" , self.revDate, substituted0 ) substituted1 = re.sub ( r"@revdate@" , self.revDate, substituted0 )
substituted1 = re.sub ( r"@githash@" , self.gitHash, substituted1 ) substituted1 = re.sub ( r"@githash@" , self.gitHash, substituted1 )
substituted1 = re.sub ( r"@coriolisTop@", "/usr" , substituted1 ) substituted1 = re.sub ( r"@coriolisTop@", "/usr" , substituted1 )
if substituted0 == substituted1: stable = True if substituted0 == substituted1: stable = True
else: substituted0 = substituted1 else: substituted0 = substituted1
fdFileOut.write ( substituted0 ) fdFileOut.write ( substituted0 )
fdFileIn.close () fdFileIn.close ()
fdFileOut.close () fdFileOut.close ()
return return
def _doSpec ( self ): def _doSpec ( self ):
self._configure ( self.specFileIn, self.specFile ) self._configure ( self.specFileIn, self.specFile )
return return
def _doDebChangelog ( self ): def _doDebChangelog ( self ):
self._configure ( self.debChangelogIn, self.debChangelog ) self._configure ( self.debChangelogIn, self.debChangelog )
return return
def _execute ( self, command, error ): def _execute ( self, command, error ):
collections = [] collections = []
if self._devtoolset: if self._devtoolset:
collections.append( 'devtoolset-%d' % self._devtoolset ) collections.append( 'devtoolset-{}'.format(self._devtoolset) )
print 'Using devtoolset-%(v)d (scl enable devtoolset-%(v)d ...)' % {'v':self._devtoolset} print( 'Using devtoolset-{0} (scl enable devtoolset-{0} ...)'.format(self._devtoolset) )
if self._llvmtoolset: if self._llvmtoolset:
collections.append( 'llvm-toolset-%d' % self._llvmtoolset ) collections.append( 'llvm-toolset-{}'.format(self._llvmtoolset) )
print 'Using llvm-toolset-%(v)d (scl enable llvm-toolset-%(v)d ...)' % {'v':self._llvmtoolset} print( 'Using llvm-toolset-{0} (scl enable llvm-toolset-{v} ...)'.format(self._llvmtoolset) )
if collections: if collections:
commandAsString = '' commandAsString = ''
for i in range(len(command)): for i in range(len(command)):
if i: commandAsString += ' ' if i: commandAsString += ' '
if ' ' in command[i]: commandAsString += '"'+command[i]+'"' if ' ' in command[i]: commandAsString += '"'+command[i]+'"'
else: commandAsString += command[i] else: commandAsString += command[i]
command = [ 'scl', 'enable' ] command = [ 'scl', 'enable' ]
command += collections command += collections
command.append( commandAsString ) command.append( commandAsString )
sys.stdout.flush () sys.stdout.flush ()
sys.stderr.flush () sys.stderr.flush ()
child = subprocess.Popen ( command, env=self._environment, stdout=None ) child = subprocess.Popen ( command, env=self._environment, stdout=None )
@ -164,28 +148,26 @@ class Builder:
ErrorMessage( status, "%s (status:%d)."%(error,status) ).terminate() ErrorMessage( status, "%s (status:%d)."%(error,status) ).terminate()
return return
def _enableTool ( self, tool ): def _enableTool ( self, tool ):
return return
def _build ( self, tool ): def _build ( self, tool ):
toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() ) toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() )
toolBuildDir = os.path.join ( self.buildDir , tool.name ) toolBuildDir = os.path.join ( self.buildDir , tool.name )
cmakeInstallDir = os.path.join ( self.installDir, "share", "cmake", "Modules" ) cmakeInstallDir = os.path.join ( self.installDir, "share", "cmake", "Modules" )
# Supplied directly in the CMakeLists.txt. # Supplied directly in the CMakeLists.txt.
#cmakeModules = os.path.join ( self.installDir, "share", "cmake", "Modules" ) #cmakeModules = os.path.join ( self.installDir, "share", "cmake", "Modules" )
if not os.path.isdir(toolSourceDir): 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 return
if self._rmBuild: if self._rmBuild:
print "Removing tool build directory: \"%s\"." % toolBuildDir print( 'Removing tool build directory: "{}".'.format(toolBuildDir) )
command = [ "/bin/rm", "-rf", toolBuildDir ] command = [ "/bin/rm", "-rf", toolBuildDir ]
self._execute ( command, "Removing tool build directory" ) self._execute ( command, "Removing tool build directory" )
command = [ 'cmake' ] command = [ 'cmake' ]
if self.libSuffix: command += [ "-D", "LIB_SUFFIX:STRING=%s" % self.libSuffix ]
if self._ninja: command += [ "-G", "Ninja" ] if self._ninja: command += [ "-G", "Ninja" ]
if self._macports: command += [ "-D", "WITH_MACPORTS:STRING=TRUE" ] if self._macports: command += [ "-D", "WITH_MACPORTS:STRING=TRUE" ]
if self._noSystemBoost: command += [ "-D", "Boost_NO_SYSTEM_PATHS: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._bfd: command += [ "-D", "USE_LIBBFD:STRING=%s" % self._bfd ]
if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ] if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ]
if self._openmp: command += [ "-D", "WITH_OPENMP:STRING=TRUE" ] if self._openmp: command += [ "-D", "WITH_OPENMP:STRING=TRUE" ]
command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode
#, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared #, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared
, "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir , "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir
@ -203,13 +184,12 @@ class Builder:
#, "-D", "CMAKE_MODULE_PATH:STRING=%s" % cmakeModules #, "-D", "CMAKE_MODULE_PATH:STRING=%s" % cmakeModules
#, "-D", "Boost_DEBUG:STRING=TRUE" #, "-D", "Boost_DEBUG:STRING=TRUE"
, toolSourceDir ] , toolSourceDir ]
if not os.path.isdir(toolBuildDir): if not os.path.isdir(toolBuildDir):
print "Creating tool build directory: \"%s\"." % toolBuildDir print( 'Creating tool build directory: "{}".'.format(toolBuildDir) )
os.makedirs ( toolBuildDir ) os.makedirs ( toolBuildDir )
os.chdir ( toolBuildDir ) os.chdir ( toolBuildDir )
self._execute ( command, "First CMake failed" ) self._execute ( command, "First CMake failed" )
os.chdir ( toolBuildDir ) os.chdir ( toolBuildDir )
if self._noCache: if self._noCache:
cmakeCache = os.path.join(toolBuildDir,"CMakeCache.txt") cmakeCache = os.path.join(toolBuildDir,"CMakeCache.txt")
@ -226,22 +206,19 @@ class Builder:
command += [ toolSourceDir ] command += [ toolSourceDir ]
self._execute ( command, "Second CMake failed" ) self._execute ( command, "Second CMake failed" )
if self._doBuild: if self._doBuild:
command = [ "make" ] command = [ "make" ]
if self._ninja: if self._ninja:
command = [ "ninja-build" ] command = [ "ninja-build" ]
#command += [ "DESTDIR=%s" % self.installDir ] #command += [ "DESTDIR=%s" % self.installDir ]
command += self._makeArguments command += self._makeArguments
print "Make/Ninja command:", command print( "Make/Ninja command:", command )
sys.stdout.flush () sys.stdout.flush ()
self._execute ( command, "Build failed" ) self._execute ( command, "Build failed" )
return return
def gitArchive ( self, projectName ): def gitArchive ( self, projectName ):
rawArchive = self.tarballDir+'/'+projectName+'.tar' rawArchive = self.tarballDir+'/'+projectName+'.tar'
os.chdir ( self.sourceDir+'/'+projectName ) os.chdir ( self.sourceDir+'/'+projectName )
command = [ 'git' command = [ 'git'
, 'archive' , 'archive'
@ -250,11 +227,10 @@ class Builder:
, 'devel' , 'devel'
] ]
self._execute ( command, "git archive of project %s" % projectName ) self._execute ( command, "git archive of project %s" % projectName )
if not os.path.isdir ( self.archiveDir ): if not os.path.isdir ( self.archiveDir ):
os.mkdir ( self.archiveDir ) os.mkdir ( self.archiveDir )
os.chdir ( self.archiveDir ) os.chdir ( self.archiveDir )
command = [ 'tar', 'xf', rawArchive ] command = [ 'tar', 'xf', rawArchive ]
self._execute ( command, "unpacking raw archive %s" % rawArchive ) self._execute ( command, "unpacking raw archive %s" % rawArchive )
@ -265,7 +241,7 @@ class Builder:
command = [ "/bin/ln", "-s", "./coriolis/bootstrap/Makefile.package" command = [ "/bin/ln", "-s", "./coriolis/bootstrap/Makefile.package"
, self.archiveDir+"/Makefile" ] , self.archiveDir+"/Makefile" ]
self._execute ( command, "link of %s failed" % "coriolis/boostrap/Makefile.package") self._execute ( command, "link of %s failed" % "coriolis/boostrap/Makefile.package")
command = [ "/bin/ln", "-s", "./coriolis/bootstrap/debian", self.archiveDir ] command = [ "/bin/ln", "-s", "./coriolis/bootstrap/debian", self.archiveDir ]
self._execute ( command, "Copying Debian/Ubuntu package control files" ) self._execute ( command, "Copying Debian/Ubuntu package control files" )
@ -284,32 +260,27 @@ class Builder:
# , "--no-backup-if-mismatch" # , "--no-backup-if-mismatch"
# , "-p0", "-i", self.distribPatch ] # , "-p0", "-i", self.distribPatch ]
# self._execute ( command, "patch for distribution command failed" ) # self._execute ( command, "patch for distribution command failed" )
absSourceTarBz2 = '%s/%s' % (self.tarballDir,self.sourceTarBz2) absSourceTarBz2 = '%s/%s' % (self.tarballDir,self.sourceTarBz2)
os.chdir ( self.tarballDir ) os.chdir ( self.tarballDir )
command = [ 'tar', 'jcf', absSourceTarBz2, os.path.basename(self.archiveDir) ] command = [ 'tar', 'jcf', absSourceTarBz2, os.path.basename(self.archiveDir) ]
self._execute ( command, "Creating composite archive %s" % absSourceTarBz2 ) self._execute ( command, "Creating composite archive %s" % absSourceTarBz2 )
return return
def _setEnvironment ( self, systemVariable, userVariable ): def _setEnvironment ( self, systemVariable, userVariable ):
if not self._environment.has_key(systemVariable) or self._environment[systemVariable] == "": if not systemVariable in self._environment or self._environment[systemVariable] == "":
if not self._environment.has_key(userVariable) or self._environment[userVariable] == "" : if not userVariable in self._environment or self._environment[userVariable] == "" :
self._environment[ systemVariable ] = self.installDir self._environment[ systemVariable ] = self.installDir
print "[WARNING] Neither <%s> nor <%s> environment variables are sets." \ print( '[WARNING] Neither "{0}" nor "{1}" environment variables are sets.' \
% (systemVariable,userVariable) .format(systemVariable,userVariable) )
print " Setting <%s> to <%s>." % (systemVariable,self.installDir) print( ' Setting "{0}" to "{1}".'.format(systemVariable,self.installDir) )
else: else:
self._environment[ systemVariable ] = self._environment[ userVariable ] self._environment[ systemVariable ] = self._environment[ userVariable ]
if not self._quiet: if not self._quiet:
print "Setting <%s> to <%s>." % (systemVariable,self._environment[systemVariable]) print( 'Setting "{0}" to "{1}".'.format(systemVariable,self._environment[systemVariable]) )
if self._environment.has_key(userVariable): if userVariable in self._environment:
print "Transmitting <%s> as <%s>." % (userVariable,self._environment[userVariable]) print( 'Transmitting "{0}" as "{1}".'.format(userVariable,self._environment[userVariable]) )
return return
def _commandTemplate ( self, tools, projects, command ): def _commandTemplate ( self, tools, projects, command ):
if self._clang: if self._clang:
self._environment[ 'CC' ] = 'clang' self._environment[ 'CC' ] = 'clang'
@ -320,87 +291,70 @@ class Builder:
if self._macports: if self._macports:
self._environment[ 'BOOST_INCLUDEDIR' ] = '/opt/local/include' self._environment[ 'BOOST_INCLUDEDIR' ] = '/opt/local/include'
self._environment[ 'BOOST_LIBRARYDIR' ] = '/opt/local/lib' self._environment[ 'BOOST_LIBRARYDIR' ] = '/opt/local/lib'
# Set or guess the various projects TOP environment variables. # Set or guess the various projects TOP environment variables.
for project in self.projects: for project in self.projects:
topVariable = "%s_TOP" % project.getName().upper() topVariable = "%s_TOP" % project.getName().upper()
topUserVariable = "%s_USER_TOP" % project.getName().upper() topUserVariable = "%s_USER_TOP" % project.getName().upper()
self._setEnvironment ( topVariable, topUserVariable ) self._setEnvironment ( topVariable, topUserVariable )
if tools: if tools:
# Checks if the requested tools are in the various projects. # Checks if the requested tools are in the various projects.
self.standalones = tools self.standalones = tools
for project in self.projects: for project in self.projects:
self.standalones = project.activate ( self.standalones ) self.standalones = project.activate ( self.standalones )
for tool in 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: if projects:
for projectName in projects: for projectName in projects:
project = self.getProject ( projectName ) project = self.getProject ( projectName )
if not project: if not project:
ErrorMessage( 1, "No project of name \"%s\"."%projectName ).terminate() ErrorMessage( 1, "No project of name \"%s\"."%projectName ).terminate()
project.activateAll() project.activateAll()
if not tools and not projects: if not tools and not projects:
for project in self.projects: for project in self.projects:
project.activateAll () project.activateAll ()
for project in self.projects: for project in self.projects:
for tool in project.getActives(): for tool in project.getActives():
print "\nProcessing tool: \"%s\"." % tool.name print( '\nProcessing tool: "{}".'.format(tool.name) )
getattr(self,command) ( tool ) getattr(self,command) ( tool )
return return
def enable ( self, tools, projects ): def enable ( self, tools, projects ):
self._commandTemplate ( tools, projects, "_enableTool" ) self._commandTemplate ( tools, projects, "_enableTool" )
return return
def enabledTools ( self ): def enabledTools ( self ):
tools = [] tools = []
for project in self.projects: for project in self.projects:
tools += project.getActives() tools += project.getActives()
return tools return tools
def build ( self, tools, projects ): def build ( self, tools, projects ):
self._commandTemplate ( tools, projects, "_build" ) self._commandTemplate ( tools, projects, "_build" )
return return
def gitTarball ( self, tools, projects ): def gitTarball ( self, tools, projects ):
if self.gitHash == "x": if self.gitHash == "x":
self._guessGitHash ( self.getProject(projects[0]) ) self._guessGitHash ( self.getProject(projects[0]) )
self._doSpec () self._doSpec ()
# self._doDebChangelog () # self._doDebChangelog ()
if os.path.isdir(self.tarballDir): 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 ] command = [ "/bin/rm", "-rf", self.tarballDir ]
self._execute ( command, "Removing top export (tarball) directory" ) self._execute ( command, "Removing top export (tarball) directory" )
print( 'Creating tarball directory: "{}".'.format(self.tarballDir) )
print "Creating tarball directory: \"%s\"." % self.tarballDir
os.makedirs ( self.tarballDir ) os.makedirs ( self.tarballDir )
self.gitArchive ( projects[0] ) self.gitArchive ( projects[0] )
return return
def userTarball ( self, tools, projects ): def userTarball ( self, tools, projects ):
self.enable( tools, projects ) self.enable( tools, projects )
userSourceTarBz2 = os.path.join ( self.tarballDir userSourceTarBz2 = os.path.join ( self.tarballDir
, datetime.date.today().strftime('%s-%s-%%Y%%m%%d.tar.bz2'% , datetime.date.today().strftime('%s-%s-%%Y%%m%%d.tar.bz2'%
(self.packageName (self.packageName
,self.packageVersion)) ) ,self.packageVersion)) )
excludes = [] excludes = []
for exclude in self.packageExcludes: for exclude in self.packageExcludes:
excludes += [ '--exclude='+exclude ] excludes += [ '--exclude='+exclude ]
os.chdir ( self.sourceDir ) os.chdir ( self.sourceDir )
command = [ "/bin/tar" command = [ "/bin/tar"
, "--exclude-backups" , "--exclude-backups"
@ -410,40 +364,34 @@ class Builder:
+ [ "-jcvf", userSourceTarBz2 ] \ + [ "-jcvf", userSourceTarBz2 ] \
+ self.enabledTools() + self.enabledTools()
self._execute ( command, "tar command failed" ) self._execute ( command, "tar command failed" )
return return
def doRpm ( self ): def doRpm ( self ):
self.gitTarball ( [], self.packageProjects ) self.gitTarball ( [], self.packageProjects )
for rpmDir in [ "SOURCES", "SPECS", "BUILD", "tmp" for rpmDir in [ "SOURCES", "SPECS", "BUILD", "tmp"
, "SRPMS", "RPMS/i386", "RPMS/i686", "RPMS/x86_64" ]: , "SRPMS", "RPMS/i386", "RPMS/i686", "RPMS/x86_64" ]:
rpmFullDir = os.path.join ( self.rpmbuildDir, rpmDir ) rpmFullDir = os.path.join ( self.rpmbuildDir, rpmDir )
if not os.path.isdir(rpmFullDir): if not os.path.isdir(rpmFullDir):
os.makedirs ( rpmFullDir ) os.makedirs ( rpmFullDir )
else: else:
for entry in os.listdir(rpmFullDir): for entry in os.listdir(rpmFullDir):
path = os.path.join( rpmFullDir, entry ) path = os.path.join( rpmFullDir, entry )
if os.path.islink(path): if os.path.islink(path):
realpath = os.path.realpath( os.readlink(path) ) realpath = os.path.realpath( os.readlink(path) )
if not os.path.isfile(realpath): if not os.path.isfile(realpath):
print 'Remove obsolete link: <%s>.' % path print( 'Remove obsolete link: "{}".'.format(path) )
os.unlink( path ) os.unlink( path )
rpmSpecFile = os.path.join ( self.rpmbuildDir, "SPECS" , "coriolis2.spec" ) rpmSpecFile = os.path.join ( self.rpmbuildDir, "SPECS" , "coriolis2.spec" )
rpmSourceFile = os.path.join ( self.rpmbuildDir, "SOURCES", self.sourceTarBz2 ) rpmSourceFile = os.path.join ( self.rpmbuildDir, "SOURCES", self.sourceTarBz2 )
sourceFile = os.path.join ( self.tarballDir , self.sourceTarBz2 ) sourceFile = os.path.join ( self.tarballDir , self.sourceTarBz2 )
if os.path.isfile ( rpmSpecFile ): if os.path.isfile ( rpmSpecFile ):
os.unlink ( rpmSpecFile ) os.unlink ( rpmSpecFile )
os.symlink ( self.specFile, rpmSpecFile ) os.symlink ( self.specFile, rpmSpecFile )
if not os.path.islink ( rpmSourceFile ): if not os.path.islink ( rpmSourceFile ):
os.symlink ( sourceFile, rpmSourceFile ) os.symlink ( sourceFile, rpmSourceFile )
os.chdir ( self.rpmbuildDir ) os.chdir ( self.rpmbuildDir )
command = [ "/usr/bin/rpmbuild" command = [ "/usr/bin/rpmbuild"
, "--define", "_topdir %s" % self.rpmbuildDir , "--define", "_topdir %s" % self.rpmbuildDir
, "--define", "_tmppath %s" % self.tmppathDir , "--define", "_tmppath %s" % self.tmppathDir
@ -452,18 +400,13 @@ class Builder:
if self._devtoolset: if self._devtoolset:
command += [ "--define", "scl devtoolset-%d"%self._devtoolset ] command += [ "--define", "scl devtoolset-%d"%self._devtoolset ]
command += [ "-ba", "--clean", rpmSpecFile ] command += [ "-ba", "--clean", rpmSpecFile ]
self._execute ( command, "Rebuild rpm packages" ) self._execute ( command, "Rebuild rpm packages" )
return return
def doDeb ( self ): def doDeb ( self ):
self.svnTarball ( [], self.packageProjects ) self.svnTarball ( [], self.packageProjects )
if not os.path.isdir(self.debbuildDir): if not os.path.isdir(self.debbuildDir):
os.makedirs ( self.debbuildDir ) os.makedirs ( self.debbuildDir )
os.chdir ( self.debbuildDir ) os.chdir ( self.debbuildDir )
sourceFile = os.path.join ( self.tarballDir , self.sourceTarBz2 ) sourceFile = os.path.join ( self.tarballDir , self.sourceTarBz2 )
debOrigFile = os.path.join ( self.debbuildDir, "coriolis2_1.0.%s.orig.tar.bz2" % self.gitHash ) 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 ) packageDir = os.path.join ( self.debbuildDir, "coriolis2-1.0.%s" % self.gitHash )
os.chdir ( packageDir ) os.chdir ( packageDir )
self._environment["CFLAGS" ] = "-O2" self._environment["CFLAGS" ] = "-O2"
self._environment["CXXFLAGS"] = "-O2" self._environment["CXXFLAGS"] = "-O2"
command = [ "/usr/bin/debuild", "-us", "-uc" ] command = [ "/usr/bin/debuild", "-us", "-uc" ]
self._execute ( command, "Rebuild Debian packages" ) self._execute ( command, "Rebuild Debian packages" )
return return
def getProject ( self, name ): return self._conf.getProject(name) def getProject ( self, name ): return self._conf.getProject(name)
def loadConfiguration ( self, confFile ): self._conf.load( confFile ) def loadConfiguration ( self, confFile ): self._conf.load( confFile )
def showConfiguration ( self ): self._conf.show() def showConfiguration ( self ): self._conf.show()

View File

@ -2,75 +2,72 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/BuilderGui.py" | # | Python : "./builder/BuilderGui.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
from PyQt4.QtGui import QTabWidget from PyQt4.QtGui import QTabWidget, QApplication, QMainWindow, \
from PyQt4.QtGui import QApplication QAction , QKeySequence
from PyQt4.QtGui import QMainWindow from .OptionsWidget import OptionsWidget
from PyQt4.QtGui import QAction from .CompileWidget import CompileWidget
from PyQt4.QtGui import QKeySequence from .ConfigureWidget import ConfigureWidget
from OptionsWidget import OptionsWidget from .AboutWidget import AboutWidget
from CompileWidget import CompileWidget
from ConfigureWidget import ConfigureWidget
from AboutWidget import AboutWidget
class BuilderGui ( QMainWindow ): class BuilderGui ( QMainWindow ):
def __init__ ( self, confFile, parent=None ): def __init__ ( self, confFile, parent=None ):
QMainWindow.__init__( self, parent ) QMainWindow.__init__( self, parent )
self.setWindowTitle( 'Coriolis/Chams Builder' ) self.setWindowTitle( 'Coriolis Toolchain Builder' )
self._tabWidget = QTabWidget() self._tabWidget = QTabWidget()
self._configureWidget = ConfigureWidget(confFile) self._configureWidget = ConfigureWidget(confFile)
self._optionsWidget = OptionsWidget(self._configureWidget.conf) self._optionsWidget = OptionsWidget(self._configureWidget.conf)
self._compileWidget = CompileWidget() self._compileWidget = CompileWidget()
self._aboutWidget = AboutWidget() self._aboutWidget = AboutWidget()
self._tabWidget.addTab( self._optionsWidget , 'Options' ) self._tabWidget.addTab( self._optionsWidget , 'Options' )
self._tabWidget.addTab( self._compileWidget , 'Compile' ) self._tabWidget.addTab( self._compileWidget , 'Compile' )
self._tabWidget.addTab( self._configureWidget, 'Configure' ) self._tabWidget.addTab( self._configureWidget, 'Configure' )
self.setCentralWidget( self._tabWidget ) self.setCentralWidget( self._tabWidget )
self._compileWidget.conf = self._configureWidget self._compileWidget.conf = self._configureWidget
self._compileWidget.options = self._optionsWidget self._compileWidget.options = self._optionsWidget
self._exitAction = QAction( '&Exit', self ) self._exitAction = QAction( '&Exit', self )
self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' ) self._exitAction.setStatusTip( 'Exit CCB (settings are saved)' )
self._exitAction.setShortcut ( QKeySequence('CTRL+Q') ) self._exitAction.setShortcut ( QKeySequence('CTRL+Q') )
self._exitAction.triggered.connect( QApplication.closeAllWindows ) self._exitAction.triggered.connect( QApplication.closeAllWindows )
self._saveAction = QAction( '&Save Settings', self ) self._saveAction = QAction( '&Save Settings', self )
self._saveAction.setStatusTip( 'Save Settings' ) self._saveAction.setStatusTip( 'Save Settings' )
self._saveAction.setShortcut ( QKeySequence('CTRL+S') ) self._saveAction.setShortcut ( QKeySequence('CTRL+S') )
self._saveAction.triggered.connect( self._configureWidget.saveSettings ) self._saveAction.triggered.connect( self._configureWidget.saveSettings )
self._saveAction.triggered.connect( self._optionsWidget.saveSettings ) self._saveAction.triggered.connect( self._optionsWidget.saveSettings )
self._saveAction.triggered.connect( self._compileWidget.saveSettings ) self._saveAction.triggered.connect( self._compileWidget.saveSettings )
self._aboutAction = QAction( '&About', self ) self._aboutAction = QAction( '&About', self )
self._aboutAction.setStatusTip( 'A Word About Who\'s Responsible for This Thing' ) self._aboutAction.setStatusTip( 'A Word About Who\'s Responsible for This Thing' )
self._aboutAction.setShortcut ( QKeySequence('CTRL+A') ) self._aboutAction.setShortcut ( QKeySequence('CTRL+A') )
self._aboutAction.triggered.connect( self._aboutWidget.show ) self._aboutAction.triggered.connect( self._aboutWidget.show )
fileMenu = self.menuBar().addMenu( 'File' ) fileMenu = self.menuBar().addMenu( 'File' )
fileMenu.addAction( self._exitAction ) fileMenu.addAction( self._exitAction )
fileMenu.addAction( self._saveAction ) fileMenu.addAction( self._saveAction )
fileMenu.addAction( self._aboutAction ) fileMenu.addAction( self._aboutAction )
return return
def closeEvent ( self, event ): def closeEvent ( self, event ):
self._configureWidget.saveSettings() self._configureWidget.saveSettings()
self._optionsWidget .saveSettings() self._optionsWidget .saveSettings()
self._compileWidget .saveSettings() self._compileWidget .saveSettings()
event.accept() event.accept()
return return

View File

@ -2,11 +2,11 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
@ -17,195 +17,166 @@
import re import re
import subprocess import subprocess
from PyQt4.QtCore import Qt from PyQt4.QtCore import Qt, pyqtSignal, QSettings
from PyQt4.QtCore import pyqtSignal from PyQt4.QtGui import QFont, QColor, QPalette, QTextCharFormat, \
from PyQt4.QtCore import QSettings QWidget, QLabel, QPushButton, QCheckBox, \
from PyQt4.QtGui import QFont QGroupBox, QButtonGroup, QVBoxLayout, \
from PyQt4.QtGui import QColor QHBoxLayout, QGridLayout, QScrollArea, \
from PyQt4.QtGui import QPalette QComboBox, QLineEdit, QTextEdit, \
from PyQt4.QtGui import QTextCharFormat QFileDialog, QProgressBar, QApplication
from PyQt4.QtGui import QWidget from .Highlighter import Highlighter
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
class CompileWidget ( QWidget ): class CompileWidget ( QWidget ):
progress = pyqtSignal(int) progress = pyqtSignal(int)
def __init__ ( self, parent=None ): def __init__ ( self, parent=None ):
QWidget.__init__ ( self, parent ) QWidget.__init__ ( self, parent )
self._options = None self._options = None
self._conf = 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 ]
if self.options.buildMode == 'Debug': self._go = QPushButton( 'Go' )
command += [ '--debug' ] self._go.setMaximumWidth( 100 )
return toolsCount, command font = self._go.font()
font.setPointSizeF( font.pointSizeF()*2.0 )
font.setWeight ( QFont.Bold )
def go ( self ): self._go.setFont( font )
rePercentage = re.compile(r'^\[\s*(?P<percent>\d+)%\].*') self._go.clicked.connect( self.go )
reProcessTool = re.compile(r'^Processing tool:\s*"(?P<tool>.+)"')
self._saveLog = QPushButton( 'Save' )
if not self.options or not self.conf: return saveLogLabel = QLabel( 'Log File:' )
saveLogBrowse = QPushButton( '&Browse' )
toolsCount, command = self.shellCommand() saveLogBrowse.clicked.connect( self.browseSaveLog )
if not toolsCount: return self._saveLogEdit = QLineEdit( '' )
self._progressBar.reset() gLayout = QGridLayout()
self._progressBar.setRange( 0, toolsCount*100 ) gLayout.addWidget( saveLogLabel , 0, 0, 1, 1, Qt.AlignRight )
gLayout.addWidget( self._saveLogEdit, 0, 1, 1, 6 )
strCommand = command[0] gLayout.addWidget( saveLogBrowse , 0, 7, 1, 1 )
for arg in command[1:]:
strCommand += ' ' + arg self._console = QTextEdit()
strCommand += '\n\n' self._console.setLineWrapMode( QTextEdit.NoWrap )
self._console.setFontItalic( True ) self._console.setMinimumSize ( 800, 400 )
self._console.insertPlainText( strCommand ) palette = self._console.palette()
self._console.setFontItalic( False ) palette.setColor( QPalette.Base, QColor.fromRgb(255,255,221) ) # ffffdd.
self._console.setPalette( palette )
toolsDone = -1 font = QFont( 'Bitstream Vera Sans Mono', self._console.font().pointSize() )
builderProcess = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) self._console.setFont( font )
while True: self._highlighter = Highlighter( self._console.document() )
line = builderProcess.stdout.readline()
if line == '': break self._progressBar = QProgressBar()
self._progressBar.setRange ( 0, 100 )
m = rePercentage.match( line ) self._progressBar.setTextVisible( True )
if m:
self.progress.emit( toolsDone*100+int(m.group('percent')) ) hLayout = QHBoxLayout()
else: hLayout.addStretch()
m = reProcessTool.match( line ) hLayout.addWidget( self._go )
if m: hLayout.addStretch()
toolsDone += 1 hLayout.addWidget( self._saveLog )
hLayout.addStretch()
self._console.insertPlainText( line )
vLayout = QVBoxLayout()
scrollBar = self._console.verticalScrollBar() vLayout.addLayout( hLayout )
scrollBar.setValue( scrollBar.maximum() ) vLayout.addLayout( gLayout )
QApplication.processEvents() vLayout.addWidget( self._progressBar )
builderProcess.wait() vLayout.addWidget( self._console )
if builderProcess.returncode == None: self.setLayout( vLayout )
pass
return self.progress.connect( self._progressBar.setValue )
self._saveLog.clicked.connect( self.saveLog )
def readSettings ( self ):
settings = QSettings() self.readSettings()
self._saveLogEdit.setText( settings.value('compile/saveLog').toString() ) return
return
def _setOptions ( self, options ): self._options = options
def saveSettings ( self ): def _setConf ( self, conf ): self._conf = conf
settings = QSettings() def _getOptions ( self ): return self._options
settings.setValue( 'compile/saveLog', self._saveLogEdit.text() ) def _getConf ( self ): return self._conf
return
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 -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/Configuration.py" | # | Python : "./builder/Configuration.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
@ -21,8 +21,8 @@ import os
import os.path import os.path
import datetime import datetime
import subprocess import subprocess
from . import ErrorMessage from . import ErrorMessage
from Project import Project from .Project import Project
class Configuration ( object ): class Configuration ( object ):
@ -64,31 +64,26 @@ class Configuration ( object ):
self._updateSecondary() self._updateSecondary()
return return
def __setattr__ ( self, attribute, value ): def __setattr__ ( self, attribute, value ):
if attribute in Configuration.SecondaryNames: 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 return
if attribute[0] == '_': if attribute[0] == '_':
self.__dict__[attribute] = value self.__dict__[attribute] = value
return return
if attribute == 'rootDir': value = os.path.expanduser(value) if attribute == 'rootDir': value = os.path.expanduser(value)
elif attribute == 'enableShared' and value != 'ON': value = 'OFF' elif attribute == 'enableShared' and value != 'ON': value = 'OFF'
self.__dict__['_'+attribute] = value self.__dict__['_'+attribute] = value
self._updateSecondary() self._updateSecondary()
return return
def __getattr__ ( self, attribute ): def __getattr__ ( self, attribute ):
if attribute[0] != '_': attribute = '_'+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 ) raise ErrorMessage( 1, 'Configuration has no attribute <%s>.'%attribute )
return self.__dict__[attribute] return self.__dict__[attribute]
def _updateSecondary ( self ): def _updateSecondary ( self ):
if self._enableShared == "ON": self._libMode = "Shared" if self._enableShared == "ON": self._libMode = "Shared"
else: self._libMode = "Static" else: self._libMode = "Static"
@ -109,7 +104,6 @@ class Configuration ( object ):
, "%s.%s" % (self._buildMode,self._libMode) ) , "%s.%s" % (self._buildMode,self._libMode) )
self._buildDir = os.path.join ( self._osDir, "build" ) self._buildDir = os.path.join ( self._osDir, "build" )
self._installDir = os.path.join ( self._osDir, "install" ) self._installDir = os.path.join ( self._osDir, "install" )
self._specFileIn = os.path.join ( self._bootstrapDir, "%s.spec.in"%self._packageName ) self._specFileIn = os.path.join ( self._bootstrapDir, "%s.spec.in"%self._packageName )
self._specFile = os.path.join ( self._bootstrapDir, "%s.spec" %self._packageName ) self._specFile = os.path.join ( self._bootstrapDir, "%s.spec" %self._packageName )
self._debianDir = os.path.join ( self._bootstrapDir, "debian" ) 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 ) self._distribPatch = os.path.join ( self._sourceDir, "bootstrap", "%s-for-distribution.patch"%self._packageName )
return return
def _guessOs ( self ): def _guessOs ( self ):
self._libSuffix = None self._libSuffix = None
self._osSlsoc7x_64 = re.compile (".*Linux.*(el7|slsoc7).*x86_64.*") 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_64 = re.compile (".*CYGWIN_NT-10\.[0-3].*x86_64.*")
self._osCygwinW10 = re.compile (".*CYGWIN_NT-10\.[0-3].*i686.*") self._osCygwinW10 = re.compile (".*CYGWIN_NT-10\.[0-3].*i686.*")
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines() lines = uname.stdout.readlines()
osLine = lines[0].decode( 'ascii' )
if self._osSlsoc7x_64.match(lines[0]): if self._osSlsoc7x_64.match(osLine):
self._osType = "Linux.el7_64" self._osType = "Linux.el7_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osSlsoc6x_64.match(lines[0]): elif self._osSlsoc6x_64.match(osLine):
self._osType = "Linux.slsoc6x_64" self._osType = "Linux.slsoc6x_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osSlsoc6x .match(lines[0]): self._osType = "Linux.slsoc6x" elif self._osSlsoc6x .match(osLine): self._osType = "Linux.slsoc6x"
elif self._osSLSoC5x_64.match(lines[0]): elif self._osSLSoC5x_64.match(osLine):
self._osType = "Linux.SLSoC5x_64" self._osType = "Linux.SLSoC5x_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osSLSoC5x .match(lines[0]): self._osType = "Linux.SLSoC5x" elif self._osSLSoC5x .match(osLine): self._osType = "Linux.SLSoC5x"
elif self._osFedora_64 .match(lines[0]): elif self._osFedora_64 .match(osLine):
self._osType = "Linux.fc_64" self._osType = "Linux.fc_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osFedora .match(lines[0]): self._osType = "Linux.fc" elif self._osFedora .match(osLine): self._osType = "Linux.fc"
elif self._osLinux_64 .match(lines[0]): elif self._osLinux_64 .match(osLine):
self._osType = "Linux.x86_64" self._osType = "Linux.x86_64"
if os.path.exists("/usr/lib64/"): if os.path.exists("/usr/lib64/"):
self._libSuffix = "64" self._libSuffix = "64"
elif self._osLinux .match(lines[0]): self._osType = "Linux.i386" elif self._osLinux .match(osLine): self._osType = "Linux.i386"
elif self._osDarwin .match(lines[0]): self._osType = "Darwin" elif self._osDarwin .match(osLine): self._osType = "Darwin"
elif self._osFreeBSD8x_amd64.match(lines[0]): elif self._osFreeBSD8x_amd64.match(osLine):
self._osType = "FreeBSD.8x.amd64" self._osType = "FreeBSD.8x.amd64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osFreeBSD8x_64.match(lines[0]): elif self._osFreeBSD8x_64.match(osLine):
self._osType = "FreeBSD.8x.x86_64" self._osType = "FreeBSD.8x.x86_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osFreeBSD8x .match(lines[0]): self._osType = "FreeBSD.8x.i386" elif self._osFreeBSD8x .match(osLine): self._osType = "FreeBSD.8x.i386"
elif self._osCygwinW7_64.match(lines[0]): elif self._osCygwinW7_64.match(osLine):
self._osType = "Cygwin.W7_64" self._osType = "Cygwin.W7_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osCygwinW7.match(lines[0]): self._osType = "Cygwin.W7" elif self._osCygwinW7.match(osLine): self._osType = "Cygwin.W7"
elif self._osCygwinW8_64.match(lines[0]): elif self._osCygwinW8_64.match(osLine):
self._osType = "Cygwin.W8_64" self._osType = "Cygwin.W8_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osCygwinW8.match(lines[0]): self._osType = "Cygwin.W8" elif self._osCygwinW8.match(osLine): self._osType = "Cygwin.W8"
elif self._osCygwinW10_64.match(lines[0]): elif self._osCygwinW10_64.match(osLine):
self._osType = "Cygwin.W10_64" self._osType = "Cygwin.W10_64"
self._libSuffix = "64" self._libSuffix = "64"
elif self._osCygwinW10.match(lines[0]): self._osType = "Cygwin.W10" elif self._osCygwinW10.match(osLine): self._osType = "Cygwin.W10"
else: else:
uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE )
self._osType = uname.stdout.readlines()[0][:-1] self._osType = uname.stdout.readlines()[0][:-1]
print "[WARNING] Unrecognized OS: \"%s\"." % lines[0][:-1] print( '[WARNING] Unrecognized OS: "{}."'.format(osLine[:-1]) )
print " (using: \"%s\")" % self._osType print( ' (using: "{}")'.format(self._osType) )
if self._libSuffix == '64' and not os.path.exists('/usr/lib64'): if self._libSuffix == '64' and not os.path.exists('/usr/lib64'):
self._libSuffix = None self._libSuffix = None
return return
def getPrimaryIds ( self ): return Configuration.PrimaryNames def getPrimaryIds ( self ): return Configuration.PrimaryNames
def getSecondaryIds ( self ): return Configuration.SecondaryNames def getSecondaryIds ( self ): return Configuration.SecondaryNames
def getAllIds ( self ): return Configuration.PrimaryNames + Configuration.SecondaryNames def getAllIds ( self ): return Configuration.PrimaryNames + Configuration.SecondaryNames
def register ( self, project ): def register ( self, project ):
for registered in self._projects: for registered in self._projects:
if registered.getName() == project.getName(): 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 return
self._projects += [ project ] self._projects += [ project ]
return return
def getProject ( self, name ): def getProject ( self, name ):
for project in self._projects: for project in self._projects:
if project.getName() == name: if project.getName() == name:
return project return project
return None return None
def getToolProject ( self, name ): def getToolProject ( self, name ):
for project in self._projects: for project in self._projects:
if project.hasTool(name): if project.hasTool(name):
return project return project
return None return None
def load ( self, confFile ): def load ( self, confFile ):
moduleGlobals = globals() moduleGlobals = globals()
if not confFile: 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])) locations = [ os.path.abspath(os.path.dirname(sys.argv[0]))
, os.environ['HOME']+'/coriolis-2.x/src/coriolis/bootstrap' , os.environ['HOME']+'/coriolis-2.x/src/coriolis/bootstrap'
, os.environ['HOME']+'/coriolis/src/coriolis/bootstrap' , os.environ['HOME']+'/coriolis/src/coriolis/bootstrap'
@ -247,86 +234,82 @@ class Configuration ( object ):
for location in locations: for location in locations:
self._confFile = location + '/build.conf' self._confFile = location + '/build.conf'
print ' <%s>' % self._confFile print( ' "{}"'.format(self._confFile) )
if os.path.isfile(self._confFile): break if os.path.isfile(self._confFile): break
if not self._confFile: if not self._confFile:
ErrorMessage( 1, 'Cannot locate any configuration file.' ).terminate() ErrorMessage( 1, 'Cannot locate any configuration file.' ).terminate()
else: else:
print 'Using user-supplied configuration file:' print( 'Using user-supplied configuration file:' )
print ' <%s>' % confFile print( ' "{}"'.format(confFile) )
self._confFile = confFile self._confFile = confFile
if not os.path.isfile(self._confFile): if not os.path.isfile(self._confFile):
ErrorMessage( 1, 'Missing configuration file:', '<%s>'%self._confFile ).terminate() ErrorMessage( 1, 'Missing configuration file:', '<%s>'%self._confFile ).terminate()
print 'Reading configuration from:' print( 'Reading configuration from:' )
print ' <%s>' % self._confFile print( ' "{}"'.format(self._confFile) )
try: try:
execfile( self._confFile, moduleGlobals ) exec( open(self._confFile).read(), globals() )
except Exception, e: except Exception as e:
ErrorMessage( 1, 'An exception occured while loading the configuration file:' ErrorMessage( 1, 'An exception occured while loading the configuration file:'
, '<%s>\n' % (self._confFile) , '<%s>\n' % (self._confFile)
, 'You should check for simple python errors in this file.' , 'You should check for simple python errors in this file.'
, 'Error was:' , 'Error was:'
, '%s\n' % e ).terminate() , '%s\n' % e ).terminate()
if moduleGlobals.has_key('projects'): if 'projects' in moduleGlobals:
entryNb = 0 entryNb = 0
for entry in moduleGlobals['projects']: for entry in moduleGlobals['projects']:
entryNb += 1 entryNb += 1
if not entry.has_key('name'): if not 'name' in entry:
raise ErrorMessage( 1, 'Missing project name in project entry #%d.' % entryNb ) 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>).' \ raise ErrorMessage( 1, 'Missing tools list in project entry #%d (<%s>).' \
% (entryNb,entry['name']) ) % (entryNb,entry['name']) )
if not isinstance(entry['tools'],list): if not isinstance(entry['tools'],list):
raise ErrorMessage( 1, 'Tools item of project entry #%d (<%s>) is not a list.' \ raise ErrorMessage( 1, 'Tools item of project entry #%d (<%s>) is not a list.' \
% (entryNb,entry['name']) ) % (entryNb,entry['name']) )
if not entry.has_key('repository'): if not 'repository' in entry:
raise ErrorMessage( 1, 'Missing project repository in project entry #%d.' \ raise ErrorMessage( 1, 'Missing project repository in project entry #%d.' \
% entryNb ) % entryNb )
self.register( Project(entry['name'],entry['tools'],entry['repository']) ) self.register( Project(entry['name'],entry['tools'],entry['repository']) )
else: else:
ErrorMessage( 1, 'Configuration file is missing the \'project\' symbol.' ErrorMessage( 1, 'Configuration file is missing the "project" symbol.'
, '<%s>'%self._confFile ).terminate() , '"{}"'.format(self._confFile) ).terminate()
if moduleGlobals.has_key('projectdir'): if 'projectdir' in moduleGlobals:
self.projectDir = moduleGlobals['projectdir'] self.projectDir = moduleGlobals['projectdir']
if 'svnconfig' in moduleGlobals:
if moduleGlobals.has_key('svnconfig'):
svnconfig = moduleGlobals['svnconfig'] svnconfig = moduleGlobals['svnconfig']
if svnconfig.has_key('method'): self._svnMethod = svnconfig['method'] if 'method' in svnconfig: self._svnMethod = svnconfig['method']
if 'package' in moduleGlobals:
if moduleGlobals.has_key('package'):
package = moduleGlobals['package'] package = moduleGlobals['package']
if package.has_key('name' ): self.packageName = package['name'] if 'name' in package: self.packageName = package['name']
if package.has_key('version' ): self.packageVersion = package['version'] if 'version' in package: self.packageVersion = package['version']
if package.has_key('excludes'): if 'excludes' in package:
if not isinstance(package['excludes'],list): if not isinstance(package['excludes'],list):
raise ErrorMessage( 1, 'Excludes of package configuration is not a list.') raise ErrorMessage( 1, 'Excludes of package configuration is not a list.')
self._packageExcludes = package['excludes'] self._packageExcludes = package['excludes']
if package.has_key('projects'): if 'projects' in package:
if not isinstance(package['projects'],list): if not isinstance(package['projects'],list):
raise ErrorMessage( 1, 'Projects to package is not a list.') raise ErrorMessage( 1, 'Projects to package is not a list.')
self._packageProjects = package['projects'] self._packageProjects = package['projects']
return return
def show ( self ): def show ( self ):
print 'CCB Configuration:' print( 'CCB Configuration:' )
if self._gitMethod: if self._gitMethod:
print ' Git Method: <%s>' % self._gitMethod print( ' Git Method: "{}"'.format(self._gitMethod) )
else: 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: 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 toolOrder = 1
for tool in project.getTools(): for tool in project.getTools():
print '%s%02d:<%s>' % (' '*26,toolOrder,tool) print( '{0}{1:02}:"{2}"'.format( ' '*26, toolOrder, tool ))
toolOrder += 1 toolOrder += 1
print print
return return

View File

@ -2,45 +2,32 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/ConfigureWidget.py" | # | Python : "./builder/ConfigureWidget.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
from PyQt4.QtCore import Qt from PyQt4.QtCore import Qt, QVariant, pyqtSignal, QSettings, \
from PyQt4.QtCore import QVariant QModelIndex, QAbstractTableModel
from PyQt4.QtCore import pyqtSignal from PyQt4.QtGui import QFont, QWidget, QGridLayout, QHBoxLayout, \
from PyQt4.QtCore import QSettings QVBoxLayout, QLabel, QPushButton, \
from PyQt4.QtGui import QFont QLineEdit, QAbstractItemView, QHeaderView, \
from PyQt4.QtGui import QWidget QTableView, QGroupBox, QFileDialog, \
from PyQt4.QtGui import QGridLayout QApplication
from PyQt4.QtGui import QHBoxLayout from .Configuration import Configuration
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
class ConfSettingsModel ( QAbstractTableModel ): class ConfSettingsModel ( QAbstractTableModel ):
HeaderFont = QApplication.font() HeaderFont = QApplication.font()
PrimaryFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Normal) PrimaryFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Normal)
SecondaryFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Normal) SecondaryFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Normal)
ValueFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Bold) ValueFont = QFont('Courier',HeaderFont.pointSize()-2,QFont.Bold)
@ -48,7 +35,6 @@ class ConfSettingsModel ( QAbstractTableModel ):
def __init__ ( self, conf, parent=None ): def __init__ ( self, conf, parent=None ):
ConfSettingsModel.HeaderFont.setBold( True ) ConfSettingsModel.HeaderFont.setBold( True )
ConfSettingsModel.SecondaryFont.setItalic( True ) ConfSettingsModel.SecondaryFont.setItalic( True )
QAbstractTableModel.__init__( self, parent ) QAbstractTableModel.__init__( self, parent )
self._conf = conf self._conf = conf
self._ids = self._conf.getAllIds() self._ids = self._conf.getAllIds()
@ -70,20 +56,15 @@ class ConfSettingsModel ( QAbstractTableModel ):
if row < self.rowCount(): if row < self.rowCount():
if index.column() == 0: return self._ids[row] if index.column() == 0: return self._ids[row]
elif index.column() == 1: return getattr( self._conf, self._ids[row] ) elif index.column() == 1: return getattr( self._conf, self._ids[row] )
return None
return QVariant()
def headerData ( self, section, orientation, role ): 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.FontRole: return ConfSettingsModel.HeaderFont
if role != Qt.DisplayRole: return QVariant() if role != Qt.DisplayRole: return None
if section == 0: return 'Setting' if section == 0: return 'Setting'
elif section == 1: return 'Value' elif section == 1: return 'Value'
return '?'
return QVariant('?')
def rowCount ( self, index=QModelIndex() ): return len(self._ids) def rowCount ( self, index=QModelIndex() ): return len(self._ids)
def columnCount ( self, index=QModelIndex() ): return 2 def columnCount ( self, index=QModelIndex() ): return 2
@ -119,79 +100,73 @@ class ConfSettingsWidget ( QWidget ):
peanoDataLayout = QGridLayout(); peanoDataLayout = QGridLayout();
peanoDataLayout.addWidget( self._view, 0, 0, 1, 1 ); peanoDataLayout.addWidget( self._view, 0, 0, 1, 1 );
self.setLayout ( peanoDataLayout ); self.setLayout ( peanoDataLayout );
return return
class ConfigureWidget ( QWidget ): class ConfigureWidget ( QWidget ):
def __init__ ( self, confFile, parent=None ): def __init__ ( self, confFile, parent=None ):
QWidget.__init__ ( self, parent ) QWidget.__init__ ( self, parent )
self._confFile = confFile self._confFile = confFile
self._conf = Configuration() self._conf = Configuration()
self._rootDir = '' self._rootDir = ''
rootDirLabel = QLabel( 'Root Directory' ) rootDirLabel = QLabel( 'Root Directory' )
rootDirBrowse = QPushButton( '&Browse' ) rootDirBrowse = QPushButton( '&Browse' )
rootDirBrowse.clicked.connect( self.browseRootDir ) rootDirBrowse.clicked.connect( self.browseRootDir )
self._rootDirEdit = QLineEdit( '' ) self._rootDirEdit = QLineEdit( '' )
#self._rootDirEdit.setFixedWidth( 600 ) #self._rootDirEdit.setFixedWidth( 600 )
gLayout = QGridLayout() gLayout = QGridLayout()
gLayout.addWidget( rootDirLabel , 0, 0, 1, 1 ) gLayout.addWidget( rootDirLabel , 0, 0, 1, 1 )
gLayout.addWidget( self._rootDirEdit, 0, 1, 1, 6 ) gLayout.addWidget( self._rootDirEdit, 0, 1, 1, 6 )
gLayout.addWidget( rootDirBrowse , 0, 7, 1, 1 ) gLayout.addWidget( rootDirBrowse , 0, 7, 1, 1 )
groupDirs = QGroupBox( 'Directories' ) groupDirs = QGroupBox( 'Directories' )
groupDirs.setLayout( gLayout ) groupDirs.setLayout( gLayout )
gLayout = QGridLayout()
gLayout = QGridLayout() groupConf = QGroupBox( 'Configuration' )
groupConf = QGroupBox( 'Configuration' ) groupConf.setLayout( gLayout )
groupConf.setLayout( gLayout )
vLayout = QVBoxLayout()
vLayout = QVBoxLayout() vLayout.addWidget ( groupDirs )
vLayout.addWidget ( groupDirs ) vLayout.addWidget ( groupConf )
vLayout.addWidget ( groupConf ) #vLayout.addStretch()
#vLayout.addStretch()
self.setLayout( vLayout )
self.setLayout( vLayout ) self._rootDirEdit.textChanged.connect( self.rootDirChanged )
self.readSettings()
self._rootDirEdit.textChanged.connect( self.rootDirChanged )
noteLabel = QLabel( 'Those settings can be changed only by editing build.conf' )
self.readSettings() gLayout.addWidget( noteLabel , 0, 0, 1, 1 )
gLayout.addWidget( ConfSettingsWidget(self._conf), 1, 0, 1, 1 )
noteLabel = QLabel( 'Those settings can be changed only by editing build.conf' )
gLayout.addWidget( noteLabel , 0, 0, 1, 1 ) def _getConf ( self ): return self._conf
gLayout.addWidget( ConfSettingsWidget(self._conf), 1, 0, 1, 1 ) def _getRootDir ( self ): return self._rootDir
def _getBootstrapDir ( self ): return self._getConf().bootstrapDir
def _getConf ( self ): return self._conf conf = property( _getConf )
def _getRootDir ( self ): return self._rootDir rootDir = property( _getRootDir )
def _getBootstrapDir ( self ): return self._getConf().bootstrapDir bootstrapDir = property( _getBootstrapDir )
conf = property( _getConf ) def rootDirChanged ( self, rootDir ):
rootDir = property( _getRootDir ) self._rootDir = rootDir
bootstrapDir = property( _getBootstrapDir ) return
def browseRootDir ( self ):
def rootDirChanged ( self, rootDir ): self._rootDirEdit.setText( QFileDialog.getExistingDirectory(self,'Select the Building Root Directory') )
self._rootDir = rootDir return
return
def readSettings ( self ):
def browseRootDir ( self ): settings = QSettings()
self._rootDirEdit.setText( QFileDialog.getExistingDirectory(self,'Select the Building Root Directory') ) self._rootDirEdit.setText( settings.value('conf/rootDir') )
return if not self._confFile and settings.value('conf/confFile'):
self._confFile = str( settings.value('conf/confFile') )
def readSettings ( self ): self._conf.load( self._confFile )
settings = QSettings() return
self._rootDirEdit.setText( settings.value('conf/rootDir').toString() )
if not self._confFile and settings.value('conf/confFile'): def saveSettings ( self ):
self._confFile = str( settings.value('conf/confFile').toString() ) settings = QSettings()
self._conf.load( self._confFile ) settings.setValue( 'conf/rootDir' , self._rootDirEdit.text() )
return settings.setValue( 'conf/confFile', 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 -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/Highlighter.py" | # | Python : "./builder/Highlighter.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
@ -17,64 +17,61 @@
import re import re
from PyQt4.QtCore import Qt from PyQt4.QtCore import Qt
from PyQt4.QtGui import QFont from PyQt4.QtGui import QFont, QColor, QTextCharFormat, QSyntaxHighlighter
from PyQt4.QtGui import QColor
from PyQt4.QtGui import QTextCharFormat
from PyQt4.QtGui import QSyntaxHighlighter
class Highlighter ( QSyntaxHighlighter ): class Highlighter ( QSyntaxHighlighter ):
Normal = 0x0001 Normal = 0x0001
Bold = 0x0002 Bold = 0x0002
Italic = 0x0004 Italic = 0x0004
ttyBackground = QColor.fromRgb( 255, 255, 221 ) # #ffffdd ttyBackground = QColor.fromRgb( 255, 255, 221 ) # #ffffdd
ttyBlack = QColor.fromRgb( 46, 52, 54 ) # #2e3436 ttyBlack = QColor.fromRgb( 46, 52, 54 ) # #2e3436
ttyRed = QColor.fromRgb( 204, 0, 0 ) # #cc0000 ttyRed = QColor.fromRgb( 204, 0, 0 ) # #cc0000
ttyGreen = QColor.fromRgb( 78, 154, 6 ) # #4e9a06 ttyGreen = QColor.fromRgb( 78, 154, 6 ) # #4e9a06
ttyYellow = QColor.fromRgb( 196, 160, 0 ) # #c4a000 ttyYellow = QColor.fromRgb( 196, 160, 0 ) # #c4a000
ttyBlue = QColor.fromRgb( 52, 101, 164 ) # #3465a4 ttyBlue = QColor.fromRgb( 52, 101, 164 ) # #3465a4
ttyViolet = QColor.fromRgb( 117, 80, 123 ) # #75507b ttyViolet = QColor.fromRgb( 117, 80, 123 ) # #75507b
ttyCyan = QColor.fromRgb( 6, 152, 154 ) # #06989a ttyCyan = QColor.fromRgb( 6, 152, 154 ) # #06989a
ttyGrey = QColor.fromRgb( 211, 215, 207 ) # #d3d7cf ttyGrey = QColor.fromRgb( 211, 215, 207 ) # #d3d7cf
ttyLightBlack = QColor.fromRgb( 85, 87, 83 ) # #555753 ttyLightBlack = QColor.fromRgb( 85, 87, 83 ) # #555753
ttyLightRed = QColor.fromRgb( 239, 41, 41 ) # #ef2929 ttyLightRed = QColor.fromRgb( 239, 41, 41 ) # #ef2929
ttyLightGreen = QColor.fromRgb( 138, 226, 52 ) # #8ae234 ttyLightGreen = QColor.fromRgb( 138, 226, 52 ) # #8ae234
ttyLightYellow = QColor.fromRgb( 252, 233, 79 ) # #fce94f ttyLightYellow = QColor.fromRgb( 252, 233, 79 ) # #fce94f
ttyLightBlue = QColor.fromRgb( 114, 159, 207 ) # #729fcf ttyLightBlue = QColor.fromRgb( 114, 159, 207 ) # #729fcf
ttyLightViolet = QColor.fromRgb( 173, 127, 168 ) # #ad7fa8 ttyLightViolet = QColor.fromRgb( 173, 127, 168 ) # #ad7fa8
ttyLightCyan = QColor.fromRgb( 52, 226, 226 ) # #34e2e2 ttyLightCyan = QColor.fromRgb( 52, 226, 226 ) # #34e2e2
ttyLightGrey = QColor.fromRgb( 238, 238, 236 ) # #eeeeec ttyLightGrey = QColor.fromRgb( 238, 238, 236 ) # #eeeeec
Rules = [ [ttyLightViolet, Bold , re.compile(r'^Scanning.*'), None] Rules = [ [ttyLightViolet, Bold , re.compile(r'^Scanning.*'), None]
, [ttyLightRed , Bold , re.compile(r'^Linking.*'), None] , [ttyLightRed , Bold , re.compile(r'^Linking.*'), None]
, [ttyLightGreen , Normal , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Building.*)'), 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] , [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 , Normal , re.compile(r'^\[(?P<percent>\s*\d+)%\]\s*(?P<message>Generating.*moc_.*)'), None]
, [ttyLightBlue , Bold , re.compile(r'^Generating.*'), None] , [ttyLightBlue , Bold , re.compile(r'^Generating.*'), None]
, [ttyLightCyan , Normal , re.compile(r'^Install the project.*'), None] , [ttyLightCyan , Normal , re.compile(r'^Install the project.*'), None]
, [ttyCyan , Bold , re.compile(r'^-- Install.*'), None] , [ttyCyan , Bold , re.compile(r'^-- Install.*'), None]
, [ttyCyan , Bold|Italic, re.compile(r'^-- Up-to-date.*'), None] , [ttyCyan , Bold|Italic, re.compile(r'^-- Up-to-date.*'), None]
] ]
def __init__ ( self, parent=None ): def __init__ ( self, parent=None ):
QSyntaxHighlighter.__init__ ( self, parent ) QSyntaxHighlighter.__init__ ( self, parent )
for rule in Highlighter.Rules: for rule in Highlighter.Rules:
if not rule[3]: if not rule[3]:
rule[3] = QTextCharFormat() rule[3] = QTextCharFormat()
rule[3].setForeground( rule[0] ) rule[3].setForeground( rule[0] )
if rule[1] & Highlighter.Normal: rule[3].setFontWeight( QFont.Normal ) if rule[1] & Highlighter.Normal: rule[3].setFontWeight( QFont.Normal )
if rule[1] & Highlighter.Bold: rule[3].setFontWeight( QFont.Bold ) if rule[1] & Highlighter.Bold: rule[3].setFontWeight( QFont.Bold )
if rule[1] & Highlighter.Italic: rule[3].setFontItalic( True ) if rule[1] & Highlighter.Italic: rule[3].setFontItalic( True )
return return
def highlightBlock ( self, line ): def highlightBlock ( self, line ):
for rule in Highlighter.Rules: for rule in Highlighter.Rules:
m = rule[2].match(line) m = rule[2].match(line)
if m: if m:
if m.groupdict().has_key('percent'): if 'percent' in m.groupdict():
self.setFormat( 7, len(line), rule[3] ) self.setFormat( 7, len(line), rule[3] )
else: else:
self.setFormat( 0, len(line), rule[3] ) self.setFormat( 0, len(line), rule[3] )
return return

View File

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

View File

@ -2,93 +2,83 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/ProjectWidget.py" | # | Python : "./builder/ProjectWidget.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
import string import string
from PyQt4.QtCore import Qt from PyQt4.QtCore import Qt, QObject, QSettings
from PyQt4.QtCore import QObject from PyQt4.QtGui import QSizePolicy, QFrame, QPushButton, QCheckBox, \
from PyQt4.QtCore import QSettings QLabel
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
class ProjectWidgets ( QObject ): class ProjectWidgets ( QObject ):
def __init__ ( self, project ): def __init__ ( self, project ):
self._project = project self._project = project
self._projectButton = QLabel( string.capwords(self._project.getName()) ) self._projectButton = QLabel( string.capwords(self._project.getName()) )
self._projectButton.setStyleSheet( 'font-weight: bold;' ) self._projectButton.setStyleSheet( 'font-weight: bold;' )
self._projectButton.setFrameShape( QFrame.Box ) self._projectButton.setFrameShape( QFrame.Box )
self._projectButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred ) self._projectButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred )
self._toolsCheckBoxes = []
self._toolsCheckBoxes = [] for tool in self._project.getTools():
for tool in self._project.getTools(): self._toolsCheckBoxes += [ QCheckBox( tool.name ) ]
self._toolsCheckBoxes += [ QCheckBox( tool.name ) ] #self._projectButton.clicked.connect( self.toggleToolsVisibility )
return
#self._projectButton.clicked.connect( self.toggleToolsVisibility )
return def _getProjectButton ( self ): return self._projectButton
def _getToolsCheckBoxes ( self ): return self._toolsCheckBoxes
def _getProjectButton ( self ): return self._projectButton
def _getToolsCheckBoxes ( self ): return self._toolsCheckBoxes def _getActives ( self ):
actives = []
def _getActives ( self ): for toolCb in self._toolsCheckBoxes:
actives = [] if toolCb.isChecked(): actives += [ str(toolCb.text()) ]
for toolCb in self._toolsCheckBoxes: return actives
if toolCb.isChecked(): actives += [ str(toolCb.text()) ]
return actives projectButton = property( _getProjectButton )
toolsCheckBoxes = property( _getToolsCheckBoxes )
projectButton = property( _getProjectButton ) actives = property( _getActives )
toolsCheckBoxes = property( _getToolsCheckBoxes )
actives = property( _getActives ) def addToLayout( self, column, layout ):
toolsNb = len(self._toolsCheckBoxes)
def addToLayout( self, column, layout ): if toolsNb <= 10:
toolsNb = len(self._toolsCheckBoxes) layout.addWidget( self._projectButton, 0, column, Qt.AlignLeft )
if toolsNb <= 10: for row in range(toolsNb):
layout.addWidget( self._projectButton, 0, column, Qt.AlignLeft ) layout.addWidget( self._toolsCheckBoxes[row], row+1, column, Qt.AlignTop )
for row in range(toolsNb): return 1
layout.addWidget( self._toolsCheckBoxes[row], row+1, column, Qt.AlignTop ) columnSpan = toolsNb / 10
return 1 if toolsNb % 10: columnSpan += 1
layout.addWidget( self._projectButton, 0, column, 1, columnSpan, Qt.AlignJustify )
columnSpan = toolsNb / 10 for row in range(toolsNb):
if toolsNb % 10: columnSpan += 1 if row and row % 10 == 0: column += 1
layout.addWidget( self._toolsCheckBoxes[row], row%10+1, column, Qt.AlignTop )
layout.addWidget( self._projectButton, 0, column, 1, columnSpan, Qt.AlignJustify ) return columnSpan
for row in range(toolsNb):
if row and row % 10 == 0: column += 1 #def toggleToolsVisibility ( self ):
layout.addWidget( self._toolsCheckBoxes[row], row%10+1, column, Qt.AlignTop ) # self._visibleTools = not self._visibleTools
# for toolCb in self._toolsCheckBoxes:
return columnSpan # toolCb.setVisible( self._visibleTools )
# return
#def toggleToolsVisibility ( self ):
# self._visibleTools = not self._visibleTools def readFromSettings ( self ):
# for toolCb in self._toolsCheckBoxes: settings = QSettings()
# toolCb.setVisible( self._visibleTools ) for toolCb in self._toolsCheckBoxes:
# return toolId = 'tools/'+self._project.getName()+'/'+toolCb.text()
toolCb.setChecked( bool(settings.value(toolId)) )
def readFromSettings ( self ): return
settings = QSettings()
for toolCb in self._toolsCheckBoxes: def saveToSettings ( self ):
toolId = 'tools/'+self._project.getName()+'/'+toolCb.text() settings = QSettings()
toolCb.setChecked( settings.value(toolId).toBool() ) for toolCb in self._toolsCheckBoxes:
return toolId = 'tools/'+self._project.getName()+'/'+toolCb.text()
settings.setValue( toolId, toolCb.isChecked() )
def saveToSettings ( self ): return
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 -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Author : Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./builder/__init__.py" | # | Python : "./builder/__init__.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
@ -21,8 +21,7 @@ class ErrorMessage ( Exception ):
def __init__ ( self, code, *arguments ): def __init__ ( self, code, *arguments ):
self._code = code self._code = code
self._errors = [ 'Malformed call to ErrorMessage()' self._errors = [ 'Malformed call to ErrorMessage()', '{}'.format(arguments) ]
, '%s' % str(arguments) ]
text = None text = None
if len(arguments) == 1: if len(arguments) == 1:
@ -31,7 +30,6 @@ class ErrorMessage ( Exception ):
self._errors = arguments[0] self._errors = arguments[0]
elif len(arguments) > 1: elif len(arguments) > 1:
text = list(arguments) text = list(arguments)
if text: if text:
self._errors = [] self._errors = []
while len(text[0]) == 0: del text[0] while len(text[0]) == 0: del text[0]
@ -50,11 +48,10 @@ class ErrorMessage ( Exception ):
def __str__ ( self ): def __str__ ( self ):
if not isinstance(self._errors,list): if not isinstance(self._errors,list):
return "[ERROR] %s" % self._errors return "[ERROR] %s" % self._errors
formatted = "\n" formatted = "\n"
for i in range(len(self._errors)): for i in range(len(self._errors)):
if i == 0: formatted += "[ERROR] %s" % self._errors[i] if i == 0: formatted += "[ERROR] {}".format(self._errors[i] )
else: formatted += " %s" % self._errors[i] else: formatted += " {}".format(self._errors[i] )
if i+1 < len(self._errors): formatted += "\n" if i+1 < len(self._errors): formatted += "\n"
return formatted return formatted
@ -69,7 +66,7 @@ class ErrorMessage ( Exception ):
return return
def terminate ( self ): def terminate ( self ):
print self print( self )
sys.exit(self._code) sys.exit(self._code)
def _getCode ( self ): return self._code def _getCode ( self ): return self._code

View File

@ -1,17 +1,17 @@
#!/usr/bin/env python #!/usr/bin/env python3
# #
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 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 | # | Authors : Jean-Paul Chaput |
# | Damien Dupuis | # | Damien Dupuis |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./ccb.py" | # | Python : "./ccb.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+
@ -19,37 +19,36 @@
showTrace = True showTrace = True
try: try:
import sys import sys
import os.path import os.path
import optparse import optparse
import traceback import traceback
import distutils.sysconfig import distutils.sysconfig
import subprocess import subprocess
import re import re
except ImportError, e: except ImportError as e:
module = str(e).split()[-1] module = str(e).split()[-1]
print( '[ERROR] The "{}" python module or symbol cannot be loaded.'.format(module) )
print '[ERROR] The <%s> python module or symbol cannot be loaded.' % module print( ' Please check your standard Python installation, it may have problems.' )
print ' Please check your standard Python installation, it may have problems.' quit()
quit()
def safeImport ( moduleName, symbol=None ): def safeImport ( moduleName, symbol=None ):
try: try:
module = __import__( moduleName, globals(), locals(), symbol ) module = __import__( moduleName, globals(), locals(), symbol )
except ImportError, e: except ImportError as e:
print '[ERROR] The <%s> python module or symbol cannot be loaded.' % moduleName print( '[ERROR] The "{}" python module or symbol cannot be loaded.'.format(moduleName) )
print ' Please check the integrity of the <coriolis/boostrap> package.' print( ' Please check the integrity of the "coriolis/boostrap" package.' )
if showTrace: traceback.print_tb(sys.exc_info()[2]) if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(1) sys.exit(1)
except Exception, e: except Exception as e:
print '[ERROR] An exception occured while importing module <%s>. Is is a bug,' % moduleName print( '[ERROR] An exception occured while importing module "{}". Is is a bug,'.format(moduleName) )
print ' you may want to report it...' print( ' you may want to report it...' )
print ' %s' % e print( ' {}'.format(e) )
if showTrace: traceback.print_tb(sys.exc_info()[2]) if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(2) sys.exit(2)
if symbol: return module.__dict__[symbol] if symbol: return module.__dict__[symbol]
return module return module
def checkCMake (): def checkCMake ():
@ -57,8 +56,8 @@ def checkCMake ():
(pid,status) = os.waitpid ( child.pid, 0 ) (pid,status) = os.waitpid ( child.pid, 0 )
status >>= 8 status >>= 8
if status != 0: if status != 0:
print '[ERROR] The <cmake> program has not been found, please install it.' print( '[ERROR] The "cmake" program has not been found, please install it.' )
sys.exit(1) sys.exit(1)
def guessOs (): def guessOs ():
@ -85,62 +84,60 @@ def guessOs ():
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines() lines = uname.stdout.readlines()
line = lines[0].decode( 'ascii' )
if osSlsoc7x_64.match(lines[0]): if osSlsoc7x_64.match(line):
osType = "Linux.el7_64" osType = "Linux.el7_64"
libDir = "lib64" libDir = "lib64"
elif osSlsoc6x_64.match(lines[0]): elif osSlsoc6x_64.match(line):
osType = "Linux.slsoc6x_64" osType = "Linux.slsoc6x_64"
libDir = "lib64" libDir = "lib64"
elif osSlsoc6x.match(lines[0]): elif osSlsoc6x.match(line):
osType = "Linux.slsoc6x" osType = "Linux.slsoc6x"
elif osSLSoC5x_64.match(lines[0]): elif osSLSoC5x_64.match(line):
osType = "Linux.SLSoC5x_64" osType = "Linux.SLSoC5x_64"
libDir = "lib64" libDir = "lib64"
elif osSLSoC5x .match(lines[0]): elif osSLSoC5x .match(line):
osType = "Linux.SLSoC5x" osType = "Linux.SLSoC5x"
elif osFedora_64.match(lines[0]): elif osFedora_64.match(line):
osType = "Linux.fc_64" osType = "Linux.fc_64"
libDir = "lib64" libDir = "lib64"
elif osFedora .match(lines[0]): elif osFedora .match(line):
osType = "Linux.fc" osType = "Linux.fc"
elif osLinux_64.match(lines[0]): elif osLinux_64.match(line):
osType = "Linux.x86_64" osType = "Linux.x86_64"
libDir = "lib64" libDir = "lib64"
elif osLinux .match(lines[0]): elif osLinux .match(line):
osType = "Linux.i386" osType = "Linux.i386"
elif osDarwin.match(lines[0]): elif osDarwin.match(line):
osType = "Darwin" osType = "Darwin"
elif osFreeBSD8x_amd64.match(lines[0]): elif osFreeBSD8x_amd64.match(line):
osType = "FreeBSD.8x.amd64" osType = "FreeBSD.8x.amd64"
libDir = "lib64" libDir = "lib64"
elif osFreeBSD8x_64.match(lines[0]): elif osFreeBSD8x_64.match(line):
osType = "FreeBSD.8x.x86_64" osType = "FreeBSD.8x.x86_64"
libDir = "lib64" libDir = "lib64"
elif osFreeBSD8x.match(lines[0]): elif osFreeBSD8x.match(line):
osType = "FreeBSD.8x.i386" osType = "FreeBSD.8x.i386"
elif osCygwinW7_64.match(lines[0]): elif osCygwinW7_64.match(line):
osType = "Cygwin.W7_64" osType = "Cygwin.W7_64"
libDir = "lib64" libDir = "lib64"
elif osCygwinW7.match(lines[0]): elif osCygwinW7.match(line):
osType = "Cygwin.W7" osType = "Cygwin.W7"
elif osCygwinW8_64.match(lines[0]): elif osCygwinW8_64.match(line):
osType = "Cygwin.W8_64" osType = "Cygwin.W8_64"
libDir = "lib64" libDir = "lib64"
elif osCygwinW8.match(lines[0]): elif osCygwinW8.match(line):
osType = "Cygwin.W8" osType = "Cygwin.W8"
elif osCygwinW10_64.match(lines[0]): elif osCygwinW10_64.match(line):
osType = "Cygwin.W10_64" osType = "Cygwin.W10_64"
libDir = "lib64" libDir = "lib64"
elif osCygwinW10.match(lines[0]): elif osCygwinW10.match(line):
osType = "Cygwin.W10" osType = "Cygwin.W10"
else: else:
uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE )
osType = uname.stdout.readlines()[0][:-1] osType = uname.stdout.readlines()[0][:-1]
print( '[WARNING] Unrecognized OS: "{}".'.format(lines[0][:-1]) )
print "[WARNING] Unrecognized OS: \"%s\"." % lines[0][:-1] print( ' (using: "{}")'.format(osType) )
print " (using: \"%s\")" % osType
return osType, libDir return osType, libDir
@ -151,10 +148,9 @@ def guessPythonSitePackage ():
def autoLocate (): def autoLocate ():
osType, libDir = guessOs() osType, libDir = guessOs()
print 'Building for target: <%s>' % osType print( 'Building for target: "{}"'.format(osType) )
print 'Making an educated guess to locate myself:' print( 'Making an educated guess to locate myself:' )
sitePackage = guessPythonSitePackage() sitePackage = guessPythonSitePackage()
builderDir = None builderDir = None
locations = [ os.path.abspath(os.path.dirname(sys.argv[0])) locations = [ os.path.abspath(os.path.dirname(sys.argv[0]))
, os.environ['HOME']+'/coriolis-2.x/src/coriolis/bootstrap' , 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 , os.environ['HOME']+'/coriolis-2.x/'+osType+'/Release.Shared/install/'+libDir+'/'+sitePackage
, '/users/outil/coriolis/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: for location in locations:
print ' <%s>' % location, print( ' "{}" '.format(location), end='' )
if os.path.isfile(location + '/builder/__init__.py'): if os.path.isfile(location + '/builder/__init__.py'):
if not builderDir: if not builderDir:
builderDir = location builderDir = location
print '(Found*)' print( '(Found*)' )
else: else:
print '(Found)' print( '(Found)' )
else: else:
print '(No)' print( '(No)' )
if not builderDir: if not builderDir:
print '[ERROR] Failed to locate the builder modules in any of the normal pathes.' print( '[ERROR] Failed to locate the builder modules in any of the normal pathes.' )
print ' Please check your Coriolis/Bootsrap installation.' print( ' Please check your Coriolis/Bootsrap installation.' )
if showTrace: traceback.print_tb(sys.exc_info()[2]) if showTrace: traceback.print_tb(sys.exc_info()[2])
sys.exit(1) sys.exit(1)
sys.path.insert( 0, builderDir ) sys.path.insert( 0, builderDir )
return return
@ -193,125 +185,117 @@ autoLocate()
checkCMake() checkCMake()
parser = optparse.OptionParser () parser = optparse.OptionParser ()
parser.add_option ( "-g", "--gui" , action="store_true" , dest="gui" , help="Lauch the graphical interface." ) parser.add_option ( "-g", "--gui" , action="store_true" , dest="gui" , help="Lauch the graphical interface." )
# Build relateds. # Build relateds.
parser.add_option ( "-c", "--conf" , type="string", dest="conf" , help="Fichier de configuration." ) 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 ( "--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 ( "-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 ( "-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 ( "-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 ( "-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 ( "--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 ( "-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 ( "--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-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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "--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 ( "-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. # SVN repository relateds.
# Have to be ported to Git. # 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-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-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-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-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-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-checkout" , action="store_true" , dest="svnCheckout" , help="Checkout the latest SVN version *or* the one given by svn-tag." )
# Miscellaneous. # 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 ( "--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 ( "--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 ( "--rpm" , action="store_true" , dest="doRpm" , help="Regenerate RPM packages." )
parser.add_option ( "--deb" , action="store_true" , dest="doDeb" , help="Regenerate Debian/Ubuntu packages." ) parser.add_option ( "--deb" , action="store_true" , dest="doDeb" , help="Regenerate Debian/Ubuntu packages." )
# Katabatic/Kite specific options. # 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 ( "-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 ( "-u", "--check-deter" , action="store_true" , dest="checkDeterminism", help="Enable Katabatic/Kite determinism checking (*very* slow)." )
(options, args) = parser.parse_args () (options, args) = parser.parse_args ()
if options.gui: if options.gui:
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' ) ErrorMessage = safeImport( 'builder' , 'ErrorMessage' )
QApplication = safeImport( 'PyQt4.QtGui' , 'QApplication' ) QApplication = safeImport( 'PyQt4.QtGui' , 'QApplication' )
BuilderGui = safeImport( 'builder.BuilderGui', 'BuilderGui' ) BuilderGui = safeImport( 'builder.BuilderGui', 'BuilderGui' )
try:
try: app = QApplication( sys.argv )
app = QApplication( sys.argv ) app.setOrganizationName ( 'UPMC' )
app.setOrganizationName ( 'UPMC' ) app.setOrganizationDomain( 'lip6.fr' )
app.setOrganizationDomain( 'lip6.fr' ) app.setApplicationName ( 'CoriolisBuilder' )
app.setApplicationName ( 'CoriolisBuilder' ) gui = BuilderGui( options.conf )
gui = BuilderGui( options.conf ) gui.show()
gui.show() rcode = app.exec_()
rcode = app.exec_() sys.exit( rcode )
sys.exit( rcode ) except ErrorMessage as e:
except ErrorMessage, e: print( e )
print e if showTrace: traceback.print_tb(sys.exc_info()[2])
if showTrace: traceback.print_tb(sys.exc_info()[2]) sys.exit(2)
sys.exit(2) except Exception as e:
except Exception, e: print( '[ERROR] An exception occured while running the Qt application.' )
print '[ERROR] An exception occured while running the Qt application.' print( ' {}'.format(e) )
print ' %s' % e if showTrace: traceback.print_tb(sys.exc_info()[2])
if showTrace: traceback.print_tb(sys.exc_info()[2]) sys.exit(2)
sys.exit(2)
else: else:
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' )
ErrorMessage = safeImport( 'builder' , 'ErrorMessage' ) Builder = safeImport( 'builder.Builder', 'Builder' )
Builder = safeImport( 'builder.Builder', 'Builder' ) try:
builder = Builder()
try: builder.loadConfiguration( options.conf )
builder = Builder() if options.showConf:
builder.loadConfiguration( options.conf ) builder.showConfiguration ()
sys.exit(0)
if options.showConf: if options.quiet: builder.quiet = True
builder.showConfiguration () if options.release: builder.buildMode = "Release"
sys.exit(0) if options.debug: builder.buildMode = "Debug"
if options.static: builder.enableShared = "OFF"
if options.quiet: builder.quiet = True if options.doc: builder.enableDoc = "ON"
if options.release: builder.buildMode = "Release" if options.checkDb: builder.checkDatabase = "ON"
if options.debug: builder.buildMode = "Debug" if options.checkDeterminism: builder.checkDeterminism = "ON"
if options.static: builder.enableShared = "OFF" if options.verboseMakefile: builder.verboseMakefile = "ON"
if options.doc: builder.enableDoc = "ON" if options.rootDir: builder.rootDir = options.rootDir
if options.checkDb: builder.checkDatabase = "ON" if options.noBuild: builder.doBuild = False
if options.checkDeterminism: builder.checkDeterminism = "ON" if options.noCache: builder.noCache = True
if options.verboseMakefile: builder.verboseMakefile = "ON" if options.rmBuild: builder.rmBuild = True
if options.rootDir: builder.rootDir = options.rootDir if options.ninja: builder.ninja = True
if options.noBuild: builder.doBuild = False if options.clang or options.llvmtoolset: builder.clang = True
if options.noCache: builder.noCache = True if options.macports: builder.macports = True
if options.rmBuild: builder.rmBuild = True if options.devtoolset: builder.devtoolset = options.devtoolset
if options.ninja: builder.ninja = True if options.llvmtoolset: builder.llvmtoolset = options.llvmtoolset
if options.clang or options.llvmtoolset: builder.clang = True if options.bfd: builder.bfd = "ON"
if options.macports: builder.macports = True if options.qt5: builder.qt5 = True
if options.devtoolset: builder.devtoolset = options.devtoolset if options.openmp: builder.openmp = True
if options.llvmtoolset: builder.llvmtoolset = options.llvmtoolset if options.makeArguments: builder.makeArguments = options.makeArguments
if options.bfd: builder.bfd = "ON" #if options.svnMethod: builder.svnMethod = options.svnMethod
if options.qt5: builder.qt5 = True #if options.svnTag: builder.svnTag = options.svnTag
if options.openmp: builder.openmp = True #if options.svnStatus: builder.svnStatus ( tools=options.tools, projects=options.projects )
if options.makeArguments: builder.makeArguments = options.makeArguments #elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects )
#if options.svnMethod: builder.svnMethod = options.svnMethod #elif options.svnDiff: builder.svnDiff ( tools=options.tools, projects=options.projects )
#if options.svnTag: builder.svnTag = options.svnTag #elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects )
if options.userTarball: builder.userTarball ( tools=options.tools, projects=options.projects )
#if options.svnStatus: builder.svnStatus ( tools=options.tools, projects=options.projects ) elif options.tarball: builder.svnTarball ( tools=options.tools, projects=options.projects )
#elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects ) elif options.doRpm: builder.doRpm ()
#elif options.svnDiff: builder.svnDiff ( tools=options.tools, projects=options.projects ) elif options.doDeb: builder.doDeb ()
#elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects ) else: builder.build ( tools=options.tools, projects=options.projects )
if options.userTarball: builder.userTarball ( tools=options.tools, projects=options.projects ) except ErrorMessage as e:
elif options.tarball: builder.svnTarball ( tools=options.tools, projects=options.projects ) print( e )
elif options.doRpm: builder.doRpm () if showTrace: traceback.print_tb(sys.exc_info()[2])
elif options.doDeb: builder.doDeb () sys.exit(e.code)
else: builder.build ( tools=options.tools, projects=options.projects ) except KeyboardInterrupt as e:
except ErrorMessage, e: print( '\n[ERROR] Interrupted by user\'s request (CTRL+C)' )
print e sys.exit(1)
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)
sys.exit(0) sys.exit(0)

View File

@ -94,12 +94,12 @@
set(ADDTIONAL_FLAGS "") set(ADDTIONAL_FLAGS "")
set(CXX_STANDARD "c++11") set(CXX_STANDARD "c++11")
endif() 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 -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 ${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 -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_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 -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 ${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 -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) #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} ) target_link_libraries( ${pytarget} ${pyDeplibs} )
install( TARGETS ${pytarget} DESTINATION ${PYTHON_SITE_PACKAGES} ) install( TARGETS ${pytarget} DESTINATION ${Python_CORIOLISARCH} )
if( NOT ("${pyIncludes}" STREQUAL "None") ) if( NOT ("${pyIncludes}" STREQUAL "None") )
install( FILES ${pyIncludes} DESTINATION ${inc_install_dir} ) install( FILES ${pyIncludes} DESTINATION ${inc_install_dir} )
endif() endif()
endmacro( add_python_module ) 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(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. # This way avoids newline in the script string.
set(SCRIPT "import os.path,distutils.sysconfig") set(SCRIPT "import os.path,distutils.sysconfig")
set(SCRIPT "${SCRIPT}; pathes = distutils.sysconfig.get_python_lib().split('/')") set(SCRIPT "${SCRIPT}; pathes = distutils.sysconfig.get_python_lib('platstdlib').split('/')")
set(SCRIPT "${SCRIPT}; print os.path.join(pathes[-2],pathes[-1])") 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 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 OUTPUT_STRIP_TRAILING_WHITESPACE
) )
@ -17,14 +30,17 @@ if(UNIX)
set(FindPythonSitePackages_FOUND FALSE) set(FindPythonSitePackages_FOUND FALSE)
endif(RETURN_CODE EQUAL 0) endif(RETURN_CODE EQUAL 0)
set(PYTHON_SITE_PACKAGES "lib${LIB_SUFFIX}/${PYTHON_SITE_PACKAGES}" set(Python_CORIOLISARCH "lib${LIB_SUFFIX}/${Python_CORIOLISARCH}"
CACHE STRING "Python site packages directory." FORCE) CACHE STRING "Python platform dependent install directory." FORCE)
mark_as_advanced(PYTHON_SITE_PACKAGES) 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(FindPythonSitePackages_FOUND)
if(NOT FindPythonSitePackages_FIND_QUIETLY) if(NOT FindPythonSitePackages_FIND_QUIETLY)
if(FindPythonSitePackages_FOUND) if(FindPythonSitePackages_FOUND)
message(STATUS "Found FindPythonSitePackages : ${PYTHON_SITE_PACKAGES}") message(STATUS "Found FindPythonSitePackages : ${Python_CORIOLISARCH}")
endif(FindPythonSitePackages_FOUND) endif(FindPythonSitePackages_FOUND)
endif(NOT FindPythonSitePackages_FIND_QUIETLY) endif(NOT FindPythonSitePackages_FIND_QUIETLY)
else(FindPythonSitePackages_FOUND) else(FindPythonSitePackages_FOUND)

View File

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

View File

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

View File

@ -14,15 +14,14 @@
setup_project_paths(CORIOLIS) setup_project_paths(CORIOLIS)
set_cmake_policies() set_cmake_policies()
setup_boost(program_options filesystem python regex) setup_boost(program_options)
setup_qt() setup_qt()
setup_qwt() setup_qwt()
find_package(Libexecinfo REQUIRED) find_package(Libexecinfo REQUIRED)
find_package(PythonLibs 2 REQUIRED) find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED) find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED) find_package(LEFDEF REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(FLUTE REQUIRED) find_package(FLUTE REQUIRED)
find_package(HURRICANE REQUIRED) find_package(HURRICANE REQUIRED)
find_package(CORIOLIS 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: try:
import sys import sys
import os.path import os.path
import helpers.io import helpers.io
from helpers.io import ErrorMessage from helpers.io import ErrorMessage
from helpers.io import WarningMessage from helpers.io import WarningMessage
import Viewer import Viewer
except Exception, e: except Exception as e:
helpers.io.catch( e ) helpers.io.catch( e )
sys.exit( 1 ) sys.exit( 1 )
def boraHook ( **kw ): def boraHook ( **kw ):
bora = None bora = None
if kw.has_key('bora'): if 'bora' in kw:
bora = kw['bora'] bora = kw['bora']
else: else:
print ErrorMessage( 3, 'boraHook(): Must be run from a BoraEngine.' ) print( ErrorMessage( 3, 'boraHook(): Must be run from a BoraEngine.' ))
return return
try: try:
userInit = os.path.join( os.getcwd(), 'coriolis2/bora.py' ) userInit = os.path.join( os.getcwd(), 'coriolis2/bora.py' )
if (os.path.exists(userInit)): if (os.path.exists(userInit)):
execfile( userInit ) exec( open(userInit).read() )
except Exception, e: except Exception as e:
helpers.io.catch( e ) helpers.io.catch( e )
return return

View File

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

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 | // | C O R I O L I S |
@ -63,12 +63,21 @@ extern "C" {
}; };
// --------------------------------------------------------------- static PyModuleDef PyBora_ModuleDef =
// Module Initialization : "initBora ()" { 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(); PyParameterRange_LinkPyType();
PyStepParameterRange_LinkPyType(); PyStepParameterRange_LinkPyType();
@ -95,12 +104,11 @@ extern "C" {
PYTYPE_READY_SUB( BoraEngine , ToolEngine ); PYTYPE_READY_SUB( BoraEngine , ToolEngine );
PYTYPE_READY_SUB( GraphicBoraEngine , GraphicTool ); PYTYPE_READY_SUB( GraphicBoraEngine , GraphicTool );
PyObject* module = PyModule_Create( &PyBora_ModuleDef );
PyObject* module = Py_InitModule( "Bora", PyBora_Methods );
if (module == NULL) { if (module == NULL) {
cerr << "[ERROR]\n" cerr << "[ERROR]\n"
<< " Failed to initialize Bora module." << endl; << " Failed to initialize Bora module." << endl;
return; return NULL;
} }
Py_INCREF( &PyTypeParameterRange ); Py_INCREF( &PyTypeParameterRange );
@ -128,6 +136,8 @@ extern "C" {
PySlicingNode_postModuleInit(); PySlicingNode_postModuleInit();
PyBoraEngine_postModuleInit(); PyBoraEngine_postModuleInit();
return module;
} }

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ def toRGB ( color ):
, str(options[attribute])] ) , str(options[attribute])] )
# Try a predefined color lookup. # 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. # Try a RGB hexa: #RRGGBB.
if color[0] == '#': if color[0] == '#':

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -26,23 +26,21 @@ def addDevice ( **kw ):
global tech global tech
try: try:
if kw.has_key('name'): if 'name' in kw:
devDesc = tech.addDeviceDescriptor( kw['name'] ) devDesc = tech.addDeviceDescriptor( kw['name'] )
if 'spice' in kw: devDesc.setSpiceFilePath( kw['spice'] )
if kw.has_key('spice'): if 'connectors' in kw:
devDesc.setSpiceFilePath( kw['spice'] ) for connector in kw['connectors']:
devDesc.addConnector( connector )
if kw.has_key('connectors'): else:
for connector in kw['connectors']: print( WarningMessage( 'common.addDevice(): Missing connectors on device "{}".' \
devDesc.addConnector( connector ) .format(kw['name'])))
else: if 'layouts' in kw:
print WarningMessage( 'common.addDevice(): Missing connectors on device "%s".' % kw['name' ]) for layout in kw['layouts']:
devDesc.addLayout( layout[0], layout[1] )
if kw.has_key('layouts'): else:
for layout in kw['layouts']: print( WarningMessage( 'common.addDevice(): Missing layouts on device "{}".' \
devDesc.addLayout( layout[0], layout[1] ) .format( kw['name'] )))
else: except Exception as e:
print WarningMessage( 'common.addDevice(): Missing layouts on device "%s".' % kw['name' ]) helpers.io.catch( e )
except Exception, e:
helpers.io.catch( e )
return 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.hTracksReservedLocal', 'Vert. Locally Reserved Tracks', 0 )
layout.addParameter( 'Kite', 'kite.vTracksReservedLocal', 'Hor. 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.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.addSection ( 'Kite', 'Ripup Limits', 1 )
layout.addParameter( 'Kite', 'kite.strapRipupLimit' , 'Straps' , 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.ParameterWidgetFlags.UseSpinBox ) layout.addParameter( 'Kite', 'kite.localRipupLimit' , 'Locals' , 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.globalRipupLimit' , 'Globals' , 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox ) layout.addParameter( 'Kite', 'kite.globalRipupLimit' , 'Globals' , 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addParameter( 'Kite', 'kite.longGlobalRipupLimit', 'Long Globals', 1, 1, Cfg.ParameterWidgetFlags.UseSpinBox ) layout.addParameter( 'Kite', 'kite.longGlobalRipupLimit', 'Long Globals', 1, 1, Cfg.Parameter.Flags.UseSpinBox )
layout.addRule ( 'Kite' ) layout.addRule ( 'Kite' )

View File

@ -1,13 +1,13 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
# | Alliance / Hurricane Interface | # | Alliance / Hurricane Interface |
# | | # | |
# | Author : Jean-Paul CHAPUT | # | Author : Jean-Paul CHAPUT |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | # | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== | # | =============================================================== |
# | Python : "./etc/common/misc.py" | # | Python : "./etc/common/misc.py" |
# +-----------------------------------------------------------------+ # +-----------------------------------------------------------------+

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -16,6 +16,7 @@
import sys import sys
import math import math
import helpers import helpers
from helpers import irange
from helpers.io import ErrorMessage from helpers.io import ErrorMessage
from helpers.io import WarningMessage from helpers.io import WarningMessage
@ -67,10 +68,9 @@ class Pattern ( object ):
byte = byte << 1 byte = byte << 1
if line[i] != ' ': byte += 1 if line[i] != ' ': byte += 1
hexasLSB += [ hex(byte)[2:] ] hexasLSB += [ hex(byte)[2:] ]
# Convert in MSB mode. Invert the bytes by pairs. # Convert in MSB mode. Invert the bytes by pairs.
self._hexa = '' 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] self._hexa += hexasLSB[i*2+1] + hexasLSB[i*2]
return self._hexa return self._hexa
@ -79,7 +79,7 @@ class Pattern ( object ):
side = math.sqrt(4*len(self._hexa)) side = math.sqrt(4*len(self._hexa))
if pow(side,2) != 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 return None
side /= 4 side /= 4
@ -154,17 +154,17 @@ def add ( **keywords ):
global LUT global LUT
try: try:
if not keywords.has_key('name'): if not 'name' in keywords:
raise ErrorMessage(1,['patterns.add(): Malformed pattern, missing "name" argument.', str(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'] ) w = WarningMessage( 'patterns.add(): Pattern "%s" has both bits & hexa, ignoring hexa.' % keywords['name'] )
print w print( w )
del keywords['hexa'] del keywords['hexa']
LUT[ keywords['name'] ] = Pattern( **keywords ) LUT[ keywords['name'] ] = Pattern( **keywords )
except Exception, e: except Exception as e:
helpers.io.catch( e ) helpers.io.catch( e )
return return
@ -173,7 +173,7 @@ def add ( **keywords ):
def toHexa ( key ): def toHexa ( key ):
global LUT 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 return LUT[key].hexa

View File

@ -16,7 +16,7 @@
import Cfg import Cfg
import helpers.io import helpers.io
helpers.io.vprint( 1, ' o Loading "node180.scn6m_deep_09" technology.' ) 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 Hurricane import DataBase
from CRL import System from CRL import System

View File

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

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
#import common.analog #import common.analog

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,16 +14,14 @@
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.devices import common.devices
from common.devices import addDevice from common.devices import addDevice
chamsDir = helpers.sysConfDir + '/share/coriolis2/' chamsDir = helpers.sysConfDir + '/share/coriolis2/'
spiceDir = chamsDir + 'spice/' spiceDir = chamsDir + 'spice/'
addDevice( name = 'DifferentialPairBulkConnected' addDevice( name = 'DifferentialPairBulkConnected'
, spice = spiceDir+'DiffPairBulkConnected.spi' , spice = spiceDir+'DiffPairBulkConnected.spi'
, connectors = ( 'D1', 'D2', 'G1', 'G2', 'S' ) , connectors = ( 'D1', 'D2', 'G1', 'G2', 'S' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,9 +14,8 @@
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.display import common.display
common.display.createStyles( scale=0.5 ) common.display.createStyles( scale=0.5 )

View File

@ -9,7 +9,7 @@
# Used revision 8.00 of May 11, 2009. # Used revision 8.00 of May 11, 2009.
import helpers.io 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 DbU
from helpers.analogtechno import Length from helpers.analogtechno import Length

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.etesian import common.etesian

View File

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

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.misc import common.misc

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,6 +14,6 @@
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.patterns import common.patterns

View File

@ -15,7 +15,7 @@
import Cfg import Cfg
import helpers.io 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 helpers import l, u, n

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -15,10 +15,9 @@
import Cfg import Cfg
import helpers.io import helpers.io
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) ) helpers.io.vprint( 2, ' - "{}".'.format(helpers.truncPath(__file__)) )
import common.stratus1 import common.stratus1
Cfg.getParamString( "stratus1.format" ).setString( "vst" ) Cfg.getParamString( "stratus1.format" ).setString( "vst" )
Cfg.getParamString( "stratus1.simulator" ).setString( "asimut" ) Cfg.getParamString( "stratus1.simulator" ).setString( "asimut" )

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,7 +14,7 @@
import helpers.io 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 helpers import l, u, n
from Hurricane import DbU from Hurricane import DbU
@ -36,7 +36,7 @@ def setEnclosures ( layer, subLayer, enclosures ):
tech = DataBase.getDB().getTechnology() tech = DataBase.getDB().getTechnology()
if tech: if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() ) print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else: else:
tech = Technology.create( DataBase.getDB(), 'freepdk45' ) tech = Technology.create( DataBase.getDB(), 'freepdk45' )

View File

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

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,19 +14,19 @@
import helpers.io 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 helpers import l, u, n
from Hurricane import DbU from Hurricane import DbU
from Hurricane import DataBase from Hurricane import DataBase
from Hurricane import Technology from Hurricane import Technology
tech = DataBase.getDB().getTechnology() tech = DataBase.getDB().getTechnology()
if tech: if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() ) print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'format(tech.getName()) ))
else: else:
tech = Technology.create( DataBase.getDB(), 'phenitec06' ) tech = Technology.create( DataBase.getDB(), 'phenitec06' )
DbU.setPrecision ( 2 ) DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.002, DbU.UnitPowerMicro ) DbU.setPhysicalsPerGrid ( 0.002, DbU.UnitPowerMicro )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -16,23 +16,21 @@
import os import os
import os.path import os.path
import helpers.io 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 Environment
from CRL import AllianceFramework from CRL import AllianceFramework
allianceTop = None allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'): if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP'] allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop): if not os.path.isdir(allianceTop):
allianceTop = None allianceTop = None
if not allianceTop: allianceTop = '/soc/alliance' if not allianceTop: allianceTop = '/soc/alliance'
cellsTop = allianceTop+'/cells' cellsTop = allianceTop+'/cells'
af = AllianceFramework.get()
af = AllianceFramework.get() env = af.getEnvironment()
env = af.getEnvironment()
env.setSCALE_X ( 100 ) env.setSCALE_X ( 100 )
env.setCATALOG ( 'CATAL' ) env.setCATALOG ( 'CATAL' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -16,7 +16,7 @@
from helpers import l, u, n from helpers import l, u, n
from helpers.io import WarningMessage from helpers.io import WarningMessage
import helpers.io 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 DbU
from Hurricane import DataBase from Hurricane import DataBase
@ -25,9 +25,9 @@ from Hurricane import Technology
tech = DataBase.getDB().getTechnology() tech = DataBase.getDB().getTechnology()
if tech: if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() ) print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else: else:
tech = Technology.create( DataBase.getDB(), 'cmos' ) tech = Technology.create( DataBase.getDB(), 'cmos' )
DbU.setPrecision ( 2 ) DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.5, DbU.UnitPowerMicro ) DbU.setPhysicalsPerGrid ( 0.5, DbU.UnitPowerMicro )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -16,24 +16,21 @@
import os import os
import os.path import os.path
import helpers.io 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
from CRL import Environment
from CRL import AllianceFramework
allianceTop = None allianceTop = None
if os.environ.has_key('ALLIANCE_TOP'): if 'ALLIANCE_TOP' in os.environ:
allianceTop = os.environ['ALLIANCE_TOP'] allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop): if not os.path.isdir(allianceTop):
allianceTop = None allianceTop = None
if not allianceTop: allianceTop = '/soc/alliance' if not allianceTop: allianceTop = '/soc/alliance'
cellsTop = allianceTop+'/cells' cellsTop = allianceTop+'/cells'
af = AllianceFramework.get()
af = AllianceFramework.get() env = af.getEnvironment()
env = af.getEnvironment()
env.setSCALE_X ( 100 ) env.setSCALE_X ( 100 )
env.setCATALOG ( 'CATAL' ) env.setCATALOG ( 'CATAL' )

View File

@ -1,6 +1,6 @@
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -14,7 +14,7 @@
import helpers.io 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 helpers import l, u, n
from Hurricane import DbU from Hurricane import DbU
@ -24,9 +24,9 @@ from Hurricane import Technology
tech = DataBase.getDB().getTechnology() tech = DataBase.getDB().getTechnology()
if tech: if tech:
print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() ) print( WarningMessage( 'cmos.technology: Technology already exists, "{}"'.format(tech.getName()) ))
else: else:
tech = Technology.create( DataBase.getDB(), 'cmos45' ) tech = Technology.create( DataBase.getDB(), 'cmos45' )
DbU.setPrecision ( 2 ) DbU.setPrecision ( 2 )
DbU.setPhysicalsPerGrid ( 0.0025, DbU.UnitPowerMicro ) 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/__init__.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/io.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers ) install( FILES helpers/io.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/utils.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers ) install( FILES helpers/utils.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/overlay.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers ) install( FILES helpers/overlay.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/analogtechno.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers ) install( FILES helpers/analogtechno.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )
install( FILES helpers/technology.py DESTINATION ${PYTHON_SITE_PACKAGES}/crlcore/helpers ) install( FILES helpers/technology.py DESTINATION ${Python_CORIOLISLIB}/crlcore/helpers )

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -25,7 +25,6 @@ Contains:
* ``overlay.CfgCache`` : A cache for Cfg parameters. * ``overlay.CfgCache`` : A cache for Cfg parameters.
""" """
from __future__ import print_function
import Cfg import Cfg
import Hurricane import Hurricane
@ -80,9 +79,6 @@ class Configuration:
Cfg.getParamEnumerate(attr).setInt( val ) Cfg.getParamEnumerate(attr).setInt( val )
else: else:
Cfg.getParamInt(attr).setInt( val ) 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): elif isinstance(val, float):
p = Cfg.getParamDouble( attr ).setDouble( val ) p = Cfg.getParamDouble( attr ).setDouble( val )
elif '%' in val: elif '%' in val:
@ -138,7 +134,6 @@ class CachedParameter ( object ):
if len(self.vEnum): p = Cfg.getParamEnumerate( self.path ) if len(self.vEnum): p = Cfg.getParamEnumerate( self.path )
elif isinstance(self.v,bool ): p = Cfg.getParamBool ( 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,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 ) elif isinstance(self.v,float): p = Cfg.getParamDouble ( self.path )
else: p = Cfg.getParamString ( self.path ) else: p = Cfg.getParamString ( self.path )
if p.type == Cfg.Parameter.Type.Enumerate: p.setInt ( self.v ) if p.type == Cfg.Parameter.Type.Enumerate: p.setInt ( self.v )
@ -281,7 +276,7 @@ class CfgCache ( object ):
vEnum = None vEnum = None
if isinstance(v,list ): vRange = v; v = None if isinstance(v,list ): vRange = v; v = None
if isinstance(v,tuple): vEnum = 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 ) self._rattr[ attr ] = CachedParameter( self._path+'.'+attr, v )
if vRange is not None: self._rattr[ attr ].vRange = vRange if vRange is not None: self._rattr[ attr ].vRange = vRange
elif vEnum is not None: self._rattr[ attr ].vEnum = vEnum 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 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. 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 path = self._path+'.'+attr if len(self._path) else attr
self._rattr[attr] = CfgCache( path, self._priority ) self._rattr[attr] = CfgCache( path, self._priority )
if isinstance(self._rattr[attr],CachedParameter): if isinstance(self._rattr[attr],CachedParameter):
@ -300,7 +295,7 @@ class CfgCache ( object ):
return self._rattr[attr] return self._rattr[attr]
def _hasCachedParam ( self, elements ): def _hasCachedParam ( self, elements ):
if not self._rattr.has_key(elements[0]): if not elements[0] in self._rattr:
return False return False
if len(elements) == 1: if len(elements) == 1:
return True return True

View File

@ -1,7 +1,7 @@
# -*- mode:Python -*- # -*- mode:Python -*-
# #
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -17,7 +17,6 @@
Some helpers to create or load a technology and it's libraries. 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 from Hurricane import DataBase, Library, BasicLayer, Layer, ViaLayer

View File

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

View File

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

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 | // | C O R I O L I S |
@ -14,12 +14,10 @@
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#ifndef CRL_CELL_DATAS_H #pragma once
#define CRL_CELL_DATAS_H
#include <set> #include <set>
#include <vector> #include <vector>
#include "vlsisapd/utilities/Path.h" #include "hurricane/utilities/Path.h"
#include "crlcore/Catalog.h" #include "crlcore/Catalog.h"
namespace Hurricane { namespace Hurricane {
class Cell; class Cell;
@ -187,5 +185,3 @@ namespace CRL {
} }
#endif // CRL_CELL_DATAS_H

View File

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

View File

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

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 | // | C O R I O L I S |
@ -18,7 +18,7 @@
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include "vlsisapd/utilities/Path.h" #include "hurricane/utilities/Path.h"
#include "crlcore/Histogram.h" #include "crlcore/Histogram.h"

View File

@ -1,14 +1,14 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 |
// | Alliance / Hurricane Interface | // | Alliance / Hurricane Interface |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./Utilities.cpp" | // | C++ Module : "./Utilities.cpp" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
@ -23,8 +23,8 @@
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
namespace boptions = boost::program_options; namespace boptions = boost::program_options;
#include "vlsisapd/utilities/Path.h" #include "hurricane/utilities/Path.h"
#include "vlsisapd/configuration/Configuration.h" #include "hurricane/configuration/Configuration.h"
#include "hurricane/Backtrace.h" #include "hurricane/Backtrace.h"
#include "hurricane/Warning.h" #include "hurricane/Warning.h"
#include "hurricane/viewer/Script.h" #include "hurricane/viewer/Script.h"

View File

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

View File

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

View File

@ -1,28 +1,26 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 |
// | Alliance / Hurricane Interface | // | Alliance / Hurricane Interface |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./crlcore/Utilities.h" | // | C++ Header : "./crlcore/Utilities.h" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#ifndef CRL_UTILITIES_H #pragma once
#define CRL_UTILITIES_H
#include <cstdarg> #include <cstdarg>
#include <cstdio> #include <cstdio>
#include <ostream> #include <ostream>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "vlsisapd/utilities/Path.h" #include "hurricane/utilities/Path.h"
#include "hurricane/Commons.h" #include "hurricane/Commons.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
#include "hurricane/Slot.h" #include "hurricane/Slot.h"
@ -464,6 +462,3 @@ class Dots {
const std::string _left; const std::string _left;
const std::string _right; const std::string _right;
}; };
#endif // CRL_UTILITIES

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 | // | C O R I O L I S |
@ -27,7 +27,7 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
#include "vlsisapd/configuration/Configuration.h" #include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h" #include "hurricane/Warning.h"
#include "hurricane/DataBase.h" #include "hurricane/DataBase.h"
#include "hurricane/BasicLayer.h" #include "hurricane/BasicLayer.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,7 +77,7 @@ extern "C" {
HTRY HTRY
PyObject* arg0; PyObject* arg0;
if (ParseOneArg("AllianceFramework.create()", args, INT_ARG, &arg0)) { if (ParseOneArg("AllianceFramework.create()", args, INT_ARG, &arg0)) {
flags = PyInt_AsUnsignedLongMask(arg0); flags = PyLong_AsUnsignedLongMask(arg0);
} }
af = AllianceFramework::create( flags ); af = AllianceFramework::create( flags );
HCATCH HCATCH
@ -230,6 +230,8 @@ extern "C" {
if ( not ParseTwoArg ( "AllianceFramework.saveCell", args, CELL_INT_ARG, &arg0, &arg1) ) return NULL; 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) ); af->saveCell ( PYCELL_O(arg0),PyAny_AsLong(arg1) );
HCATCH HCATCH

View File

@ -31,7 +31,7 @@
#include "crlcore/PyToolEngine.h" #include "crlcore/PyToolEngine.h"
#include "crlcore/PyToolEngineCollection.h" #include "crlcore/PyToolEngineCollection.h"
#include "crlcore/PyAcmSigda.h" #include "crlcore/PyAcmSigda.h"
#include "crlcore/PyIspd05.h" // #include "crlcore/PyIspd05.h"
#include "crlcore/PySpice.h" #include "crlcore/PySpice.h"
#include "crlcore/PyBlif.h" #include "crlcore/PyBlif.h"
#include "crlcore/PyGds.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 ()" // Module Initialization : "initCRL ()"
DL_EXPORT(void) initCRL () { PyMODINIT_FUNC PyInit_CRL ( void )
cdebug_log(30,0) << "initCRL()" << endl; {
cdebug_log(30,0) << "PyInit_CRL()" << endl;
PySystem_LinkPyType (); PySystem_LinkPyType ();
PyBanner_LinkPyType (); PyBanner_LinkPyType ();
@ -125,7 +140,7 @@ extern "C" {
PyToolEngine_LinkPyType (); PyToolEngine_LinkPyType ();
PyToolEngineCollection_LinkPyType (); PyToolEngineCollection_LinkPyType ();
PyAcmSigda_LinkPyType (); PyAcmSigda_LinkPyType ();
PyIspd05_LinkPyType (); // PyIspd05_LinkPyType ();
PySpice_LinkPyType (); PySpice_LinkPyType ();
PyBlif_LinkPyType (); PyBlif_LinkPyType ();
PyGds_LinkPyType (); PyGds_LinkPyType ();
@ -148,7 +163,7 @@ extern "C" {
PYTYPE_READY ( ToolEngineCollection ); PYTYPE_READY ( ToolEngineCollection );
PYTYPE_READY ( ToolEngineCollectionLocator ); PYTYPE_READY ( ToolEngineCollectionLocator );
PYTYPE_READY ( AcmSigda ); PYTYPE_READY ( AcmSigda );
PYTYPE_READY ( Ispd05 ); // PYTYPE_READY ( Ispd05 );
PYTYPE_READY ( Spice ); PYTYPE_READY ( Spice );
PYTYPE_READY ( Blif ); PYTYPE_READY ( Blif );
PYTYPE_READY ( Gds ); PYTYPE_READY ( Gds );
@ -165,11 +180,11 @@ extern "C" {
__cs.addType ( "alcCatalog" , &PyTypeCatalog , "<Catalog>" , false ); __cs.addType ( "alcCatalog" , &PyTypeCatalog , "<Catalog>" , false );
__cs.addType ( "alcCatStat" , &PyTypeCatalogState , "<Catalog::State>" , false ); __cs.addType ( "alcCatStat" , &PyTypeCatalogState , "<Catalog::State>" , false );
PyObject* module = Py_InitModule ( "CRL", PyCRL_Methods ); PyObject* module = PyModule_Create( &PyCRL_ModuleDef );
if ( module == NULL ) { if (module == NULL) {
cerr << "[ERROR]\n" cerr << "[ERROR]\n"
<< " Failed to initialize CRL module." << endl; << " Failed to initialize CRL module." << endl;
return; return NULL;
} }
Py_INCREF ( &PyTypeSystem ); Py_INCREF ( &PyTypeSystem );
@ -202,8 +217,8 @@ extern "C" {
PyModule_AddObject ( module, "ToolEngineCollectionLocator", (PyObject*)&PyTypeToolEngineCollectionLocator ); PyModule_AddObject ( module, "ToolEngineCollectionLocator", (PyObject*)&PyTypeToolEngineCollectionLocator );
Py_INCREF ( &PyTypeAcmSigda ); Py_INCREF ( &PyTypeAcmSigda );
PyModule_AddObject ( module, "AcmSigda", (PyObject*)&PyTypeAcmSigda ); PyModule_AddObject ( module, "AcmSigda", (PyObject*)&PyTypeAcmSigda );
Py_INCREF ( &PyTypeIspd05 ); // Py_INCREF ( &PyTypeIspd05 );
PyModule_AddObject ( module, "Ispd05", (PyObject*)&PyTypeIspd05 ); // PyModule_AddObject ( module, "Ispd05", (PyObject*)&PyTypeIspd05 );
Py_INCREF ( &PyTypeSpice ); Py_INCREF ( &PyTypeSpice );
PyModule_AddObject ( module, "Spice", (PyObject*)&PyTypeSpice ); PyModule_AddObject ( module, "Spice", (PyObject*)&PyTypeSpice );
Py_INCREF ( &PyTypeBlif ); Py_INCREF ( &PyTypeBlif );
@ -226,6 +241,7 @@ extern "C" {
//DbULoadConstants ( dictionnary ); //DbULoadConstants ( dictionnary );
cdebug_log(30,0) << "CRL.so loaded " << (void*)&typeid(string) << endl; 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() { extern void PyCatalogState_LinkPyType() {
cdebug_log(30,0) << "PyCatalogState_LinkType()" << endl; cdebug_log(30,0) << "PyCatalogState_LinkType()" << endl;
PyTypeCatalogState.tp_dealloc = (destructor) PyCatalogState_DeAlloc; PyTypeCatalogState.tp_dealloc = (destructor) PyCatalogState_DeAlloc;
PyTypeCatalogState.tp_compare = (cmpfunc) PyCatalogState_Cmp; PyTypeCatalogState.tp_richcompare = (richcmpfunc)PyCatalogState_Cmp;
PyTypeCatalogState.tp_repr = (reprfunc) PyCatalogState_Repr; PyTypeCatalogState.tp_repr = (reprfunc) PyCatalogState_Repr;
PyTypeCatalogState.tp_str = (reprfunc) PyCatalogState_Str; PyTypeCatalogState.tp_str = (reprfunc) PyCatalogState_Str;
PyTypeCatalogState.tp_hash = (hashfunc) PyCatalogState_Hash; PyTypeCatalogState.tp_hash = (hashfunc) PyCatalogState_Hash;
PyTypeCatalogState.tp_methods = PyCatalogState_Methods; PyTypeCatalogState.tp_methods = PyCatalogState_Methods;
} }

View File

@ -74,20 +74,36 @@ extern "C" {
}; };
DL_EXPORT(void) initConstant () { static PyModuleDef PyConstant_ModuleDef =
cdebug_log(30,0) << "initConstant()" << endl; { 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) { if (module == NULL) {
cerr << "[ERROR]\n" cerr << "[ERROR]\n"
<< " Failed to initialize Constant module." << endl; << " Failed to initialize Constant module." << endl;
return; return NULL;
} }
PyObject* dictionnary = PyModule_GetDict( module ); PyObject* dictionnary = PyModule_GetDict( module );
LoadConstants( dictionnary ); LoadConstants( dictionnary );
cdebug_log(30,0) << "Constant.so loaded " << (void*)&typeid(string) << endl; 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." } , "Return the default wire width of the given layer." }
, { "getViaWidth" , (PyCFunction)PyRoutingGauge_getViaWidth , METH_VARARGS , { "getViaWidth" , (PyCFunction)PyRoutingGauge_getViaWidth , METH_VARARGS
, "Return the default via width of the given layer." } , "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 , { "getPowerSupplyGauge" , (PyCFunction)PyRoutingGauge_getPowerSupplyGauge, METH_NOARGS
, "Return the power supply gauge (None if there isn't)." } , "Return the power supply gauge (None if there isn't)." }
, { "getLayerGauge" , (PyCFunction)PyRoutingGauge_getLayerGauge , METH_VARARGS , { "getLayerGauge" , (PyCFunction)PyRoutingGauge_getLayerGauge , METH_VARARGS

View File

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

View File

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

View File

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

View File

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

View File

@ -186,7 +186,7 @@ def pyAlimVerticalRail ( cell, xcoord ) :
# Check the value of x # Check the value of x
nb_col = cell.getAbutmentBox().getWidth() / DbU_lambda(PITCH) nb_col = cell.getAbutmentBox().getWidth() / DbU_lambda(PITCH)
if ( xcoord >= nb_col ) or ( xcoord < 0 ) : 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 ) message = "AlimVerticalRail : Illegal argument x , x must be between %d and %d\n" % ( 0, nb_col )
raise ErrorMessage(2,message) raise ErrorMessage(2,message)
@ -926,7 +926,7 @@ def pyPowerRing ( cell, core, n ) :
topRoutingLayer = db.getTechnology().getLayer( topRoutingLayerName ) topRoutingLayer = db.getTechnology().getLayer( topRoutingLayerName )
allowedDepth = CRL.AllianceFramework.get().getRoutingGauge().getLayerDepth( topRoutingLayer ) 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() UpdateSession.open()
@ -1576,7 +1576,7 @@ def pyPowerRing ( cell, core, n ) :
# end of while # end of while
# 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 # Placer au cote du nord
for ins_pad in pad_north : for ins_pad in pad_north :
@ -1976,16 +1976,16 @@ def isExternalClockPad ( ins ) :
def affichePad ( cell ) : def affichePad ( cell ) :
global pad_north, pad_south, pad_east, pad_west 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() 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() 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() 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() 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. # 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 | # | C O R I O L I S |
@ -16,6 +15,7 @@
import os import os
import sys import sys
import traceback
import Cfg import Cfg
import helpers import helpers
from helpers.io import vprint from helpers.io import vprint
@ -30,26 +30,22 @@ import CRL
from CRL import RoutingLayerGauge from CRL import RoutingLayerGauge
NoFlags = 0000 NoFlags = 0
ShowWarnings = 0001 ShowWarnings = 1
WarningsAreErrors = 0002 WarningsAreErrors = 2
loaded = False loaded = False
def kwParseMain ( **kw ):
def kwParseMain ( **kw ):
cell = None cell = None
if kw.has_key('cell') and kw['cell']: if ('cell' in kw) and kw['cell']:
cell = kw['cell'] cell = kw['cell']
editor = None editor = None
if kw.has_key('editor') and kw['editor']: if ('editor' in kw) and kw['editor']:
editor = kw['editor'] editor = kw['editor']
if cell == None: cell = editor.getCell() if cell == None: cell = editor.getCell()
#if cell == None: #if cell == None:
# raise ErrorMessage( 3, 'Chip: No cell loaded yet.' ) # raise ErrorMessage( 3, 'Chip: No cell loaded yet.' )
return cell, editor return cell, editor
@ -66,8 +62,7 @@ def kwUnicornHook ( menuPath, menuName, menuTip, moduleFile, **kw ):
editor = kw['editor'] editor = kw['editor']
if moduleFile.endswith('.pyc') or moduleFile.endswith('.pyo'): if moduleFile.endswith('.pyc') or moduleFile.endswith('.pyo'):
moduleFile = moduleFile[:-1] moduleFile = moduleFile[:-1]
if 'beforeAction' in kw:
if kw.has_key('beforeAction'):
editor.addToMenu( menuPath, menuName, menuTip, moduleFile, kw['beforeAction'] ) editor.addToMenu( menuPath, menuName, menuTip, moduleFile, kw['beforeAction'] )
else: else:
editor.addToMenu( menuPath, menuName, menuTip, moduleFile ) editor.addToMenu( menuPath, menuName, menuTip, moduleFile )
@ -110,7 +105,7 @@ class CheckUnplaced ( object ):
error = ErrorMessage( 3, message ) error = ErrorMessage( 3, message )
if self.flags & WarningsAreErrors: raise error if self.flags & WarningsAreErrors: raise error
else: print error else: print( error )
return self.unplaceds return self.unplaceds
@ -137,7 +132,7 @@ class StackedVia ( object ):
def mergeDepth ( self, depth ): def mergeDepth ( self, depth ):
if self._hasLayout: if self._hasLayout:
print WarningMessage( 'StackedVia.mergeDepth(): Cannot be called *after* StackVia.doLayout()' ) print( WarningMessage( 'StackedVia.mergeDepth(): Cannot be called *after* StackVia.doLayout()' ))
return return
if depth < self._bottomDepth: self._bottomDepth = depth if depth < self._bottomDepth: self._bottomDepth = depth
if depth > self._topDepth: self._topDepth = depth if depth > self._topDepth: self._topDepth = depth
@ -187,17 +182,32 @@ class StackedVia ( object ):
, 0 , 0 , 0 , 0
, self._width, self._height , self._width, self._height
) ) ) )
#print ' Sub-via: ', self._vias[-1] #print( ' Sub-via: ', self._vias[-1] )
return return
def loadPlugins ( pluginsDir ): 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.path.append( pluginsDir )
sys.modules['plugins'].__path__.append( pluginsDir ) sys.modules['plugins'].__path__.append( pluginsDir )
if not os.path.isdir(pluginsDir): if not os.path.isdir(pluginsDir):
print ErrorMessage( 3, 'cumulus.__init__.py: Cannot find <cumulus/plugins> directory:' \ print( ErrorMessage( 3, 'cumulus.__init__.py: Cannot find <cumulus/plugins> directory:' \
, '<%s>' % pluginsDir ) , '"{}"'.format(pluginsDir) ))
return return
moduleNames = [] moduleNames = []
@ -207,26 +217,24 @@ def loadPlugins ( pluginsDir ):
path = os.path.join(pluginsDir,entry) path = os.path.join(pluginsDir,entry)
if os.path.isdir(path): if os.path.isdir(path):
packageName = "plugins." + entry packageName = "plugins." + entry
if not sys.modules.has_key(packageName): if not packageName in sys.modules:
module = __import__( packageName, globals(), locals() ) module = __import__( packageName, globals(), locals() )
else: else:
module = sys.modules[packageName] module = sys.modules[packageName]
module.__path__.append( path ) module.__path__.append( path )
continue continue
moduleNames.append( entry[:-3] ) moduleNames.append( entry[:-3] )
moduleNames.sort() moduleNames.sort()
for moduleName in moduleNames: for moduleName in moduleNames:
try: try:
vprint( 2, ' - "%s"' % moduleName ) vprint( 2, ' - "{}"'.format(moduleName) )
module = __import__( moduleName, globals(), locals() ) module = __import__( moduleName, globals(), locals() )
except ErrorMessage, e: except ErrorMessage as e:
print e print( e )
helpers.showStackTrace( e.trace ) helpers.showStackTrace( e.trace )
except Exception, e: except Exception as e:
print e print( e )
helpers.showPythonTrace( __file__, e ) helpers.showPythonTrace( __file__, e )
return return
@ -235,7 +243,6 @@ def loadPlugins ( pluginsDir ):
def staticInitialization (): def staticInitialization ():
global loaded global loaded
if loaded: return if loaded: return
try: try:
vprint( 1, ' o Preload standard plugins.' ) vprint( 1, ' o Preload standard plugins.' )
pluginsDir = os.path.dirname(__file__) pluginsDir = os.path.dirname(__file__)
@ -243,13 +250,14 @@ def staticInitialization ():
if helpers.ndaTopDir: if helpers.ndaTopDir:
vprint( 1, ' o Preload NDA protected plugins.' ) 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 ) loadPlugins( pluginsDir )
else: else:
vprint( 1, ' o No NDA protected plugins.' ) vprint( 1, ' o No NDA protected plugins.' )
except Exception, e: except Exception as e:
helpers.showPythonTrace( __file__, e ) helpers.showPythonTrace( __file__, e )
loaded = True loaded = True
return return

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software. # 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 | # | C O R I O L I S |
@ -16,7 +16,6 @@
Manage High Fanout Net Synthesis (HFNS). Manage High Fanout Net Synthesis (HFNS).
""" """
from __future__ import print_function
import sys import sys
import os.path import os.path
import re import re

View File

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

View File

@ -1,6 +1,6 @@
#
# This file is part of the Coriolis Software. # 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 | # | 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. take into account the placement or the global wirelength.
""" """
from __future__ import print_function
import sys import sys
import os.path import os.path
import re import re

View File

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

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