checktools/checktools.py
changeset 248 b20b2eae00e9
equal deleted inserted replaced
247:99b1b1689a29 248:b20b2eae00e9
       
     1 #!/usr/bin/python
       
     2 # Copyright (c) 2009 Symbian Foundation.
       
     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 # Symbian Foundation - Initial contribution
       
    11 # 
       
    12 # Description:
       
    13 # Script to download and unpack a Symbian PDK - assumes "7z" installed to unzip the files
       
    14 
       
    15 import os
       
    16 import re
       
    17 
       
    18 def test_command(label, command, output):
       
    19   print label,
       
    20   out = os.popen(command)
       
    21   for line in out.readlines():
       
    22     if re.match(output, line) :
       
    23       out.close()
       
    24       print '\t\t[OK]'
       
    25       return 0
       
    26   out.close()
       
    27   print '\t\t[MISSING]'
       
    28   return 1
       
    29 
       
    30 print 'Symbian checktools version 0.1'
       
    31 print 'Checking for existance of needed Symbian tools\n'
       
    32 error_count = 0
       
    33 error_count += test_command('7-zip','7z -h', 'Usage:')
       
    34 error_count += test_command('PERL','perl -h', 'Usage:')
       
    35 error_count += test_command('Python','python -h', 'usage:')
       
    36 error_count += test_command('hg','hg -h', 'Mercurial')
       
    37 
       
    38 print
       
    39 
       
    40 if error_count > 0:
       
    41   print 'ERROR: One or more tools missing'
       
    42 else:
       
    43   print 'All tools OK'