1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#!/usr/bin/env python
# Copyright (C) 2004 Aaron Bentley
# <aaron.bentley@utoronto.ca>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import warnings
try:
import sys
import commands
import arch
import pylon
import options
import cmdutil
import abacmds
except ImportError, e:
print """Unable to import required file.
Please symlink Fai instead of copying it, so it can find its files."""
raise
if cmdutil.prompt("ignore deprecations"):
warnings.filterwarnings("ignore", category=DeprecationWarning)
def usage():
print "Fai development 0.2\n"
commands.Help().do_command([])
if len(sys.argv) < 2:
usage()
sys.exit(1)
fake_aba = abacmds.AbaCmds()
if commands.find_command(sys.argv[1]):
try:
commands.find_command(sys.argv[1]).do_command(sys.argv[2:])
except cmdutil.GetHelp, e:
commands.find_command(sys.argv[1]).help()
sys.exit(0)
except cmdutil.BadCommandOption, e:
print e
sys.exit(2)
except commands.CommandFailed, e:
print e
sys.exit(2)
except arch.errors.ArchiveNotRegistered, e:
print e
sys.exit(3)
except cmdutil.CantDetermineRevision, e:
print e
sys.exit(3)
except cmdutil.NoGreedy, e:
print e
sys.exit(3)
except KeyboardInterrupt, e:
print "Interrupted"
sys.exit(1)
elif commands.suggestions.has_key(sys.argv[1]):
print commands.suggestions[sys.argv[1]]
elif fake_aba.is_command(sys.argv[1]):
tree = None
try:
tree = arch.tree_root(".")
except arch.errors.TreeRootError:
pass
cmd = fake_aba.is_command(sys.argv[1])
cmd.run(cmdutil.expand_prefix_alias(sys.argv[2:], tree))
else:
if options.tla_fallthrough and cmdutil.is_tla_command(sys.argv[1]):
try:
tree = None
try:
tree = arch.tree_root(".")
except arch.errors.TreeRootError:
pass
args = cmdutil.expand_prefix_alias(sys.argv[1:], tree)
sys.exit(arch.util.exec_safe('tla', args, stderr=sys.stderr,
stdout=sys.stdout, expected=(0, 1)))
except arch.ExecProblem, e:
if e.proc.status is not None:
sys.exit(e.proc.status)
else:
raise
print "\""+sys.argv[1]+"\" is not a supported sub-command."
print "See \"fai help\" for a list of supported sub-commands."
try:
pylon.iter_revision_libraries().next()
except StopIteration, e:
print "Fai works better with revision libraries. See \"my-library\"."
# arch-tag: 24e7f99f-e88a-4023-a736-1f26265dd85e
|