configurationengine/source/dev-tools/depfea.cmd
changeset 3 e7e0ae78773e
equal deleted inserted replaced
2:87cfa131b535 3:e7e0ae78773e
       
     1 @rem
       
     2 @rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 @rem All rights reserved.
       
     4 @rem This component and the accompanying materials are made available
       
     5 @rem under the terms of "Eclipse Public License v1.0"
       
     6 @rem which accompanies this distribution, and is available
       
     7 @rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 @rem
       
     9 @rem Initial Contributors:
       
    10 @rem Nokia Corporation - initial contribution.
       
    11 @rem
       
    12 @rem Contributors:
       
    13 @rem
       
    14 @rem Description:
       
    15 @rem
       
    16 
       
    17 :: ============================================================================
       
    18 ::  Name        : depfea.cmd
       
    19 ::  Part of     : depfea
       
    20 ::  Description : depfea tool wrapper for Windows
       
    21 ::  Version     : %version: 1 %
       
    22 ::
       
    23 :: ============================================================================
       
    24 
       
    25 
       
    26 
       
    27 @echo off
       
    28 setlocal
       
    29 
       
    30 set CONE_CMDARG=%*
       
    31 set BASEDIR=%~dp0
       
    32 set CONE_BASEDIR=%BASEDIR%configurationengine\win\
       
    33 set PYTHONCASEOK=1
       
    34 
       
    35 if not exist "%CONE_BASEDIR%" (
       
    36 echo Cannot run ConE, the ConE base directory does not exist:
       
    37 echo %CONE_BASEDIR%
       
    38 exit /b 1
       
    39 )
       
    40 
       
    41 @rem Check that Python is available
       
    42 call python -c None >nul 2>&1
       
    43 if %errorlevel% neq 0 (
       
    44 echo Python is required to run ConE!
       
    45 exit /b 1
       
    46 )
       
    47 
       
    48 @REM Find out Python version
       
    49 FOR /F "tokens=*" %%i in ('PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"') do SET VER1=%%i
       
    50 
       
    51 @REM Set the used base directory based on the version
       
    52 if %VER1%==2.5 (
       
    53 set CONE_BASEDIR=%CONE_BASEDIR%2.5\
       
    54 goto EndVersionCheck
       
    55 )
       
    56 if %VER1%==2.6 (
       
    57 set CONE_BASEDIR=%CONE_BASEDIR%2.6\
       
    58 goto EndVersionCheck
       
    59 )
       
    60 echo You are using an unsupported Python version (%VER1%)
       
    61 echo ConE requires Python 2.5 or 2.6
       
    62 exit /b 1
       
    63 )
       
    64 :EndVersionCheck
       
    65 
       
    66 @rem Check that this ConE installation supports the Python version
       
    67 if not exist "%CONE_BASEDIR%" (
       
    68 echo Python version %VER1% is not supported by this ConE installation
       
    69 exit /b 1
       
    70 )
       
    71 
       
    72 @rem Set the egg cache dir to be unique to avoid egg extraction clashes
       
    73 @rem when running multiple parallel ConE instances
       
    74 FOR /F "tokens=*" %%i in ('PYTHON -c "import tempfile; d = tempfile.mkdtemp(); print d"') do SET EGG_CACHE_DIR=%%i
       
    75 @rem echo Egg cache dir: %EGG_CACHE_DIR%
       
    76 set PYTHON_EGG_CACHE=%EGG_CACHE_DIR%
       
    77 
       
    78 @rem Set environment variables and run deprfea.py
       
    79 set CONE_LIBDIR=%CONE_BASEDIR%\lib
       
    80 set CONE_SCRIPTDIR=%CONE_BASEDIR%\scripts
       
    81 set PATH=%CONE_SCRIPTDIR%;%PATH%
       
    82 set PYTHONPATH=%CONE_LIBDIR%;%PYTHONPATH%
       
    83 REM The cone_tool will parse the arguments from the environment variable
       
    84 call python "%BASEDIR%deprfea.py" %*
       
    85 set CONE_ERROR_CODE=%ERRORLEVEL%
       
    86 
       
    87 @rem Delete the egg cache dir
       
    88 call rd /S /Q "%EGG_CACHE_DIR%"
       
    89 
       
    90 if 0%CONE_EXITSHELL% equ 0 exit /b %CONE_ERROR_CODE%
       
    91 exit %CONE_ERROR_CODE%
       
    92 endlocal
       
    93 
       
    94 :: END OF depfea.cmd