sbsv2/raptor/python/raptor_start.py
changeset 0 044383f39525
child 3 e1eecf4d390d
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 #
       
     2 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 # lightweight script to start raptor
       
    16 #
       
    17 
       
    18 import raptor
       
    19 import sys
       
    20 import os
       
    21 
       
    22 profile_basename = None
       
    23 if os.environ.has_key('SBS_PROFILE_BASENAME'):
       
    24 	profile_basename = os.environ['SBS_PROFILE_BASENAME']
       
    25 	import cProfile
       
    26 
       
    27 #
       
    28 # Main takes the command-line (ignoring argv[0] which is the name of
       
    29 # this script) and returns the exit code.
       
    30 #
       
    31 try:	
       
    32 	if profile_basename is not None:
       
    33 		sys.exit(cProfile.run('raptor.Main(sys.argv[1:])',profile_basename))
       
    34 	else:
       
    35 		sys.exit(raptor.Main(sys.argv[1:]))
       
    36 except KeyboardInterrupt:
       
    37 	sys.stderr.write("ERROR: sbs: Terminated by control-c or break\n")
       
    38 	sys.exit(255)
       
    39 except ValueError, exc:
       
    40 	sys.stderr.write("ERROR: sbs: %s" % str(exc))
       
    41 	sys.exit(255)
       
    42