2013-01-12 08:57:35 -06:00
|
|
|
|
|
|
|
# -*- mode:Python -*-
|
Cleanup after SVN importation, <ccb> builder script adaptation.
Project hierarchy reorganisation:
* With svn, we were doing a tool by tool checkout, suppressing the
whole repository hierarchy level.
* The tools were also grouped, inside one repository, into multiple
projects (<bootstrap>, <vlsisapd>, <coriolis>).
* We do not want to split up each tool into a separate repository,
given their tight integration (except for vlsisapd).
* We choose to simplify, and consider all tools in a svn repository
one project. Due to the way Git clone repositories, the directory
containing the project is now to be seen under "src/".
CMake modifications:
* Now that the <vlsisapd> and <bootstrap> projects are merged into
coriolis, modificate the top CMakeLists.txt of each tool to uses
only Coriolis (and bootstrap hard wired).
CCB compile script modifications:
* Uses the new source tree hierarchy, with the project directory
inserted.
* Remove (comment) all parts relateds to svn managment.
* Git is sufficiently simple so that we do not want to integrate
command shortcut into the script.
SVN cleanup:
* Remove the obsolete <chamsin> tool, that has become the full fledged
<chams> project long time ago.
2014-02-26 11:24:41 -06:00
|
|
|
#
|
|
|
|
# This file is part of the Coriolis Software.
|
|
|
|
# Copyright (c) UPMC/LIP6 2012-2014, All Rights Reserved
|
|
|
|
#
|
|
|
|
# +-----------------------------------------------------------------+
|
|
|
|
# | C O R I O L I S |
|
|
|
|
# | C o r i o l i s / C h a m s B u i l d e r |
|
|
|
|
# | |
|
|
|
|
# | Author : Damien Dupuis |
|
|
|
|
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
|
|
|
# | =============================================================== |
|
|
|
|
# | Python : "./builder/__init__.py" |
|
|
|
|
# +-----------------------------------------------------------------+
|
2013-01-12 08:57:35 -06:00
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
class ErrorMessage ( Exception ):
|
|
|
|
|
|
|
|
def __init__ ( self, code, *arguments ):
|
|
|
|
self._code = code
|
|
|
|
self._errors = [ 'Malformed call to ErrorMessage()'
|
|
|
|
, '%s' % str(arguments) ]
|
|
|
|
|
|
|
|
text = None
|
|
|
|
if len(arguments) == 1:
|
|
|
|
if isinstance(arguments[0],Exception): text = str(arguments[0]).split('\n')
|
|
|
|
else:
|
|
|
|
self._errors = arguments[0]
|
|
|
|
elif len(arguments) > 1:
|
|
|
|
text = list(arguments)
|
|
|
|
|
|
|
|
if text:
|
|
|
|
self._errors = []
|
|
|
|
while len(text[0]) == 0: del text[0]
|
|
|
|
|
|
|
|
lstrip = 0
|
|
|
|
if text[0].startswith('[ERROR]'): lstrip = 8
|
|
|
|
|
|
|
|
for line in text:
|
|
|
|
if line[0:lstrip ] == ' '*lstrip or \
|
|
|
|
line[0:lstrip-1] == '[ERROR]':
|
|
|
|
self._errors += [ line[lstrip:] ]
|
|
|
|
else:
|
|
|
|
self._errors += [ line.lstrip() ]
|
|
|
|
return
|
|
|
|
|
|
|
|
def __str__ ( self ):
|
|
|
|
if not isinstance(self._errors,list):
|
|
|
|
return "[ERROR] %s" % self._errors
|
|
|
|
|
|
|
|
formatted = "\n"
|
|
|
|
for i in range(len(self._errors)):
|
|
|
|
if i == 0: formatted += "[ERROR] %s" % self._errors[i]
|
|
|
|
else: formatted += " %s" % self._errors[i]
|
|
|
|
if i+1 < len(self._errors): formatted += "\n"
|
|
|
|
return formatted
|
|
|
|
|
|
|
|
def addMessage ( self, message ):
|
|
|
|
if not isinstance(self._errors,list):
|
|
|
|
self._errors = [ self._errors ]
|
|
|
|
if isinstance(message,list):
|
|
|
|
for line in message:
|
|
|
|
self._errors += [ line ]
|
|
|
|
else:
|
|
|
|
self._errors += [ message ]
|
|
|
|
return
|
|
|
|
|
|
|
|
def terminate ( self ):
|
|
|
|
print self
|
|
|
|
sys.exit(self._code)
|
|
|
|
|
|
|
|
def _getCode ( self ): return self._code
|
|
|
|
|
|
|
|
code = property(_getCode)
|