configurationengine/source/scripts/tests/scripttest_common.py
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
equal deleted inserted replaced
-1:000000000000 0:2e8eeb919028
       
     1 #
       
     2 # Copyright (c) 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 "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 #
       
    16 
       
    17 import sys, os
       
    18 
       
    19 ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
       
    20 
       
    21 if sys.platform == "win32":
       
    22     CONE_SCRIPT = "cone.cmd"
       
    23 else:
       
    24     CONE_SCRIPT = "cone.sh"
       
    25 
       
    26 def get_cmd(action):
       
    27     """Return the command used to run the ConE sub-action"""
       
    28     if 'CONE_PATH' in os.environ:
       
    29         CONE_CMD = os.path.join(os.environ['CONE_PATH'], CONE_SCRIPT)
       
    30         if not os.path.exists(CONE_CMD):
       
    31             raise RuntimeError("'%s' does not exist!" % CONE_CMD)
       
    32         return '"%s" %s' % (CONE_CMD, action)
       
    33     else:
       
    34         return 'python "%s" %s' % (os.path.normpath(os.path.join(ROOT_PATH,'../cone_tool.py')), action)