checktools/checktools.py
author William Roberts <williamr@symbian.org>
Tue, 29 Jun 2010 17:58:44 +0100
changeset 300 3b8bce67b574
parent 271 b20b2eae00e9
permissions -rw-r--r--
version 0.17 - use the size information in release_metadata.xml, treat checksum errors as failures Give a clear statement of success or failure after all the unzipping (if any) is completed This version will also resume any interrupted transfers (unless you say --noresume) based on the file sizes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
271
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     1
#!/usr/bin/python
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     2
# Copyright (c) 2009 Symbian Foundation.
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     3
# All rights reserved.
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     4
# This component and the accompanying materials are made available
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     6
# which accompanies this distribution, and is available
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     8
#
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
     9
# Initial Contributors:
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    10
# Symbian Foundation - Initial contribution
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    11
# 
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    12
# Description:
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    13
# Script to download and unpack a Symbian PDK - assumes "7z" installed to unzip the files
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    14
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    15
import os
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    16
import re
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    17
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    18
def test_command(label, command, output):
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    19
  print label,
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    20
  out = os.popen(command)
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    21
  for line in out.readlines():
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    22
    if re.match(output, line) :
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    23
      out.close()
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    24
      print '\t\t[OK]'
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    25
      return 0
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    26
  out.close()
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    27
  print '\t\t[MISSING]'
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    28
  return 1
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    29
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    30
print 'Symbian checktools version 0.1'
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    31
print 'Checking for existance of needed Symbian tools\n'
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    32
error_count = 0
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    33
error_count += test_command('7-zip','7z -h', 'Usage:')
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    34
error_count += test_command('PERL','perl -h', 'Usage:')
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    35
error_count += test_command('Python','python -h', 'usage:')
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    36
error_count += test_command('hg','hg -h', 'Mercurial')
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    37
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    38
print
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    39
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    40
if error_count > 0:
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    41
  print 'ERROR: One or more tools missing'
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    42
else:
b20b2eae00e9 Added a very crude tool to check for existence of various tools in the system PATH.
teknolog
parents:
diff changeset
    43
  print 'All tools OK'