~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/devscripts/ec2test/entrypoint.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2004-06-28 10:08:03 UTC
  • mfrom: (unknown (missing))
  • Revision ID: Arch-1:rocketfuel@canonical.com%soyuz--devel--0--patch-8
add ./sourcecode directory
Patches applied:

 * david.allouche@canonical.com--2004/soyuz--devel--0--base-0
   tag of rocketfuel@canonical.com/soyuz--devel--0--patch-7

 * david.allouche@canonical.com--2004/soyuz--devel--0--patch-1
   add ./sourcecode directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
 
# GNU Affero General Public License version 3 (see the file LICENSE).
3
 
 
4
 
"""The entry point for the 'ec2' utility."""
5
 
 
6
 
__metaclass__ = type
7
 
__all__ = [
8
 
    'main',
9
 
    ]
10
 
 
11
 
import readline
12
 
import rlcompleter
13
 
import sys
14
 
 
15
 
import bzrlib
16
 
from bzrlib.errors import BzrCommandError
17
 
 
18
 
from devscripts.ec2test import builtins
19
 
from devscripts.ec2test.controller import (
20
 
    CommandRegistry, CommandExecutionMixin)
21
 
 
22
 
# Shut up pyflakes.
23
 
rlcompleter
24
 
 
25
 
readline.parse_and_bind('tab: complete')
26
 
 
27
 
class EC2CommandController(CommandRegistry, CommandExecutionMixin):
28
 
    """The 'ec2' utility registers and executes commands."""
29
 
 
30
 
 
31
 
def main():
32
 
    """The entry point for the 'ec2' script.
33
 
 
34
 
    We run the specified command, or give help if none was specified.
35
 
    """
36
 
    with bzrlib.initialize():
37
 
        controller = EC2CommandController()
38
 
        controller.install_bzrlib_hooks()
39
 
        controller.load_module(builtins)
40
 
 
41
 
        args = sys.argv[1:]
42
 
        if not args:
43
 
            args = ['help']
44
 
        try:
45
 
            controller.run(args)
46
 
        except BzrCommandError, e:
47
 
            sys.exit('ec2: ERROR: ' + str(e))