dbrtools/dbr/help.py
author MattD <mattd@symbian.org>
Sun, 13 Jun 2010 15:29:20 +0100
branchDBRToolsDev
changeset 283 398d483e91bb
parent 179 eab8a264a833
permissions -rw-r--r--
Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     6
#
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
     9
#
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    10
# Contributors:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    11
# mattd <mattd@symbian.org>
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    12
#
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    13
# Description:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    14
# DBR help - displays the DBR help
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    15
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    16
import sys
283
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    17
import os
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    18
import re
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    19
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    20
def main():
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    21
  args = sys.argv
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    22
  run(args)
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    23
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    24
def run(args):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    25
    if(len(args)):
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    26
      try:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    27
        tool = __import__(args[0])
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    28
        tool.help()
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    29
      except ImportError:
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    30
        print "No help on %s\n" % args[0]
283
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    31
        getsummary()
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    32
    else:
283
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    33
      getsummary()
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    34
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    35
def getsummary():
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    36
  debug = 0
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    37
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    38
  print "Usage:"
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    39
  modules = os.listdir(os.path.join(os.path.dirname(sys.argv[0]),'dbr'))
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    40
  for module in sorted(modules):
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    41
    modname = re.match('(.+)\.py$',module)
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    42
    if(modname):
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    43
      module = modname.group(1)
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    44
      try:
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    45
        tool = __import__(module)
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    46
        str = tool.summary()
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    47
        print "\tdbr %s\t- %s" %(module, str)
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    48
      except ImportError:
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    49
        if(debug):
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    50
          print "Couldn't import %s" % module
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    51
      except AttributeError:
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    52
        if(debug):
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    53
          print "Couldn't find summary in %s" % module
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    54
      except NameError: #if it doesn't work...
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    55
        if(debug):
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    56
          print "%s looks broken" % module
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    57
      except SyntaxError: #if it doesn't work...
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    58
        if(debug):
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    59
          print "%s looks broken" % module
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    60
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    61
      
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    62
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    63
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    64
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    65
def oldusage():
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    66
    
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    67
    print "Usage:"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    68
    print "\tdbr intro\t- basic introduction\n"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    69
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    70
    print "\tdbr getenv\t- installs a baseline NOT IMPLEMENTED"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    71
    print "\tdbr checkenv\t- Checks current environment"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    72
#    print "\tdbr diffbaseline\t- Compares baselines"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    73
    print "\tdbr diffenv\t- Compares environments"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    74
    print "\tdbr cleanenv\t- cleans the environment"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    75
    print ""
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    76
    print "\tdbr installpatch\t- installs a patch"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    77
    print "\tdbr createpatch\t- creates a patch"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    78
    print "\tdbr removepatch\t- removes a patch"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    79
    print "\tdbr listpatches\t- lists patches"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    80
    print ""
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    81
    print "\tdbr help - help"
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    82
    
283
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    83
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    84
def summary():
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    85
  return "Displays the help"
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    86
179
eab8a264a833 Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff changeset
    87
def help():
283
398d483e91bb Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents: 179
diff changeset
    88
  getsummary()