blob: 8f8aeef6ee42eee291dce650bf3a38954b2a45a0 [file] [log] [blame]
Mandeep Singh Baines116ad102011-04-27 15:16:37 -07001# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Ryan Cui9b651632011-05-11 11:38:58 -07005import ConfigParser
Dale Curtis2975c432011-05-03 17:25:20 -07006import json
Mandeep Singh Baines116ad102011-04-27 15:16:37 -07007import os
Ryan Cuiec4d6332011-05-02 14:15:25 -07008import re
Mandeep Singh Bainesa7ffa4b2011-05-03 11:37:02 -07009import sys
Mandeep Singh Baines116ad102011-04-27 15:16:37 -070010import subprocess
11
Ryan Cui1562fb82011-05-09 11:01:31 -070012from errors import (VerifyException, HookFailure, PrintErrorForProject,
13 PrintErrorsForCommit)
Ryan Cuiec4d6332011-05-02 14:15:25 -070014
Ryan Cuiec4d6332011-05-02 14:15:25 -070015
16COMMON_INCLUDED_PATHS = [
17 # C++ and friends
18 r".*\.c$", r".*\.cc$", r".*\.cpp$", r".*\.h$", r".*\.m$", r".*\.mm$",
19 r".*\.inl$", r".*\.asm$", r".*\.hxx$", r".*\.hpp$", r".*\.s$", r".*\.S$",
20 # Scripts
21 r".*\.js$", r".*\.py$", r".*\.sh$", r".*\.rb$", r".*\.pl$", r".*\.pm$",
22 # No extension at all, note that ALL CAPS files are black listed in
23 # COMMON_EXCLUDED_LIST below.
24 r"(^|.*?[\\\/])[^.]+$",
25 # Other
26 r".*\.java$", r".*\.mk$", r".*\.am$",
27]
28
Ryan Cui1562fb82011-05-09 11:01:31 -070029
Ryan Cuiec4d6332011-05-02 14:15:25 -070030COMMON_EXCLUDED_PATHS = [
Ryan Cui31e0c172011-05-04 21:00:45 -070031 # avoid doing source file checks for kernel
32 r"/src/third_party/kernel/",
33 r"/src/third_party/kernel-next/",
Paul Taysomf8b6e012011-05-09 14:32:42 -070034 r"/src/third_party/ktop/",
35 r"/src/third_party/punybench/",
Ryan Cuiec4d6332011-05-02 14:15:25 -070036 r".*\bexperimental[\\\/].*",
37 r".*\b[A-Z0-9_]{2,}$",
38 r".*[\\\/]debian[\\\/]rules$",
39]
Mandeep Singh Baines116ad102011-04-27 15:16:37 -070040
Ryan Cui1562fb82011-05-09 11:01:31 -070041
Ryan Cui9b651632011-05-11 11:38:58 -070042_CONFIG_FILE = 'PRESUBMIT.cfg'
43
44
Ryan Cui1562fb82011-05-09 11:01:31 -070045# General Helpers
46
Sean Paulba01d402011-05-05 11:36:23 -040047
Ryan Cui72834d12011-05-05 14:51:33 -070048def _run_command(cmd):
49 """Executes the passed in command and returns raw stdout output."""
50 return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
51
Ryan Cui1562fb82011-05-09 11:01:31 -070052
Mandeep Singh Baines116ad102011-04-27 15:16:37 -070053def _get_hooks_dir():
Ryan Cuiec4d6332011-05-02 14:15:25 -070054 """Returns the absolute path to the repohooks directory."""
Mandeep Singh Baines116ad102011-04-27 15:16:37 -070055 cmd = ['repo', 'forall', 'chromiumos/repohooks', '-c', 'pwd']
Ryan Cui72834d12011-05-05 14:51:33 -070056 return _run_command(cmd).strip()
Mandeep Singh Baines116ad102011-04-27 15:16:37 -070057
Ryan Cui1562fb82011-05-09 11:01:31 -070058
Ryan Cuiec4d6332011-05-02 14:15:25 -070059def _match_regex_list(subject, expressions):
60 """Try to match a list of regular expressions to a string.
61
62 Args:
63 subject: The string to match regexes on
64 expressions: A list of regular expressions to check for matches with.
65
66 Returns:
67 Whether the passed in subject matches any of the passed in regexes.
68 """
69 for expr in expressions:
70 if (re.search(expr, subject)):
71 return True
72 return False
73
Ryan Cui1562fb82011-05-09 11:01:31 -070074
Ryan Cuiec4d6332011-05-02 14:15:25 -070075def _filter_files(files, include_list, exclude_list=[]):
76 """Filter out files based on the conditions passed in.
77
78 Args:
79 files: list of filepaths to filter
80 include_list: list of regex that when matched with a file path will cause it
81 to be added to the output list unless the file is also matched with a
82 regex in the exclude_list.
83 exclude_list: list of regex that when matched with a file will prevent it
84 from being added to the output list, even if it is also matched with a
85 regex in the include_list.
86
87 Returns:
88 A list of filepaths that contain files matched in the include_list and not
89 in the exclude_list.
90 """
91 filtered = []
92 for f in files:
93 if (_match_regex_list(f, include_list) and
94 not _match_regex_list(f, exclude_list)):
95 filtered.append(f)
96 return filtered
97
Ryan Cuiec4d6332011-05-02 14:15:25 -070098
99# Git Helpers
Ryan Cui1562fb82011-05-09 11:01:31 -0700100
101
Ryan Cui4725d952011-05-05 15:41:19 -0700102def _get_upstream_branch():
103 """Returns the upstream tracking branch of the current branch.
104
105 Raises:
106 Error if there is no tracking branch
107 """
108 current_branch = _run_command(['git', 'symbolic-ref', 'HEAD']).strip()
109 current_branch = current_branch.replace('refs/heads/', '')
110 if not current_branch:
Ryan Cui1562fb82011-05-09 11:01:31 -0700111 raise VerifyException('Need to be on a tracking branch')
Ryan Cui4725d952011-05-05 15:41:19 -0700112
113 cfg_option = 'branch.' + current_branch + '.%s'
114 full_upstream = _run_command(['git', 'config', cfg_option % 'merge']).strip()
115 remote = _run_command(['git', 'config', cfg_option % 'remote']).strip()
116 if not remote or not full_upstream:
Ryan Cui1562fb82011-05-09 11:01:31 -0700117 raise VerifyException('Need to be on a tracking branch')
Ryan Cui4725d952011-05-05 15:41:19 -0700118
119 return full_upstream.replace('heads', 'remotes/' + remote)
120
Ryan Cui1562fb82011-05-09 11:01:31 -0700121
Mandeep Singh Bainesb9ed1402011-04-29 15:32:06 -0700122def _get_diff(commit):
Ryan Cuiec4d6332011-05-02 14:15:25 -0700123 """Returns the diff for this commit."""
Ryan Cui72834d12011-05-05 14:51:33 -0700124 return _run_command(['git', 'show', commit])
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700125
Ryan Cui1562fb82011-05-09 11:01:31 -0700126
Ryan Cuiec4d6332011-05-02 14:15:25 -0700127def _get_file_diff(file, commit):
128 """Returns a list of (linenum, lines) tuples that the commit touched."""
Ryan Cui72834d12011-05-05 14:51:33 -0700129 output = _run_command(['git', 'show', '-p', '--no-ext-diff', commit, file])
Ryan Cuiec4d6332011-05-02 14:15:25 -0700130
131 new_lines = []
132 line_num = 0
133 for line in output.splitlines():
134 m = re.match(r'^@@ [0-9\,\+\-]+ \+([0-9]+)\,[0-9]+ @@', line)
135 if m:
136 line_num = int(m.groups(1)[0])
137 continue
138 if line.startswith('+') and not line.startswith('++'):
139 new_lines.append((line_num, line[1:]))
140 if not line.startswith('-'):
141 line_num += 1
142 return new_lines
143
Ryan Cui1562fb82011-05-09 11:01:31 -0700144
Ryan Cuiec4d6332011-05-02 14:15:25 -0700145def _get_affected_files(commit):
146 """Returns list of absolute filepaths that were modified/added."""
Ryan Cui72834d12011-05-05 14:51:33 -0700147 output = _run_command(['git', 'diff', '--name-status', commit + '^!'])
Ryan Cuiec4d6332011-05-02 14:15:25 -0700148 files = []
149 for statusline in output.splitlines():
150 m = re.match('^(\w)+\t(.+)$', statusline.rstrip())
151 # Ignore deleted files, and return absolute paths of files
152 if (m.group(1)[0] != 'D'):
153 pwd = os.getcwd()
154 files.append(os.path.join(pwd, m.group(2)))
155 return files
156
Ryan Cui1562fb82011-05-09 11:01:31 -0700157
Mandeep Singh Bainesb9ed1402011-04-29 15:32:06 -0700158def _get_commits():
Ryan Cuiec4d6332011-05-02 14:15:25 -0700159 """Returns a list of commits for this review."""
Ryan Cui4725d952011-05-05 15:41:19 -0700160 cmd = ['git', 'log', '%s..' % _get_upstream_branch(), '--format=%H']
Ryan Cui72834d12011-05-05 14:51:33 -0700161 return _run_command(cmd).split()
Mandeep Singh Bainesb9ed1402011-04-29 15:32:06 -0700162
Ryan Cui1562fb82011-05-09 11:01:31 -0700163
Ryan Cuiec4d6332011-05-02 14:15:25 -0700164def _get_commit_desc(commit):
165 """Returns the full commit message of a commit."""
Sean Paul23a2c582011-05-06 13:10:44 -0400166 return _run_command(['git', 'log', '--format=%s%n%n%b', commit + '^!'])
Ryan Cuiec4d6332011-05-02 14:15:25 -0700167
168
169# Common Hooks
170
Ryan Cui1562fb82011-05-09 11:01:31 -0700171
Ryan Cuiec4d6332011-05-02 14:15:25 -0700172def _check_no_long_lines(project, commit):
173 """Checks that there aren't any lines longer than maxlen characters in any of
174 the text files to be submitted.
175 """
176 MAX_LEN = 80
177
178 errors = []
179 files = _filter_files(_get_affected_files(commit),
180 COMMON_INCLUDED_PATHS,
181 COMMON_EXCLUDED_PATHS)
182
183 for afile in files:
184 for line_num, line in _get_file_diff(afile, commit):
185 # Allow certain lines to exceed the maxlen rule.
186 if (len(line) > MAX_LEN and
187 not 'http://' in line and
188 not 'https://' in line and
189 not line.startswith('#define') and
190 not line.startswith('#include') and
191 not line.startswith('#import') and
192 not line.startswith('#pragma') and
193 not line.startswith('#if') and
194 not line.startswith('#endif')):
195 errors.append('%s, line %s, %s chars' % (afile, line_num, len(line)))
196 if len(errors) == 5: # Just show the first 5 errors.
197 break
198
199 if errors:
200 msg = 'Found lines longer than %s characters (first 5 shown):' % MAX_LEN
Ryan Cui1562fb82011-05-09 11:01:31 -0700201 return HookFailure(msg, errors)
202
Ryan Cuiec4d6332011-05-02 14:15:25 -0700203
204def _check_no_stray_whitespace(project, commit):
205 """Checks that there is no stray whitespace at source lines end."""
206 errors = []
207 files = _filter_files(_get_affected_files(commit),
208 COMMON_INCLUDED_PATHS,
209 COMMON_EXCLUDED_PATHS)
210
211 for afile in files:
212 for line_num, line in _get_file_diff(afile, commit):
213 if line.rstrip() != line:
214 errors.append('%s, line %s' % (afile, line_num))
215 if errors:
Ryan Cui1562fb82011-05-09 11:01:31 -0700216 return HookFailure('Found line ending with white space in:', errors)
217
Ryan Cuiec4d6332011-05-02 14:15:25 -0700218
219def _check_no_tabs(project, commit):
220 """Checks there are no unexpanded tabs."""
221 TAB_OK_PATHS = [
Doug Anderson0f91cbf2011-05-09 15:56:25 -0700222 r"/src/platform/u-boot-config/",
Ryan Cui31e0c172011-05-04 21:00:45 -0700223 r"/src/third_party/u-boot/",
224 r"/src/third_party/u-boot-next/",
Ryan Cuiec4d6332011-05-02 14:15:25 -0700225 r".*\.ebuild$",
226 r".*\.eclass$",
227 r".*/[M|m]akefile$"
228 ]
229
230 errors = []
231 files = _filter_files(_get_affected_files(commit),
232 COMMON_INCLUDED_PATHS,
233 COMMON_EXCLUDED_PATHS + TAB_OK_PATHS)
234
235 for afile in files:
236 for line_num, line in _get_file_diff(afile, commit):
237 if '\t' in line:
238 errors.append('%s, line %s' % (afile, line_num))
239 if errors:
Ryan Cui1562fb82011-05-09 11:01:31 -0700240 return HookFailure('Found a tab character in:', errors)
241
Ryan Cuiec4d6332011-05-02 14:15:25 -0700242
243def _check_change_has_test_field(project, commit):
244 """Check for a non-empty 'TEST=' field in the commit message."""
Mandeep Singh Baines96a53be2011-05-03 11:10:25 -0700245 TEST_RE = r'\n\s*TEST\s*=[^\n]*\S+'
Ryan Cuiec4d6332011-05-02 14:15:25 -0700246
Mandeep Singh Baines96a53be2011-05-03 11:10:25 -0700247 if not re.search(TEST_RE, _get_commit_desc(commit)):
Ryan Cui1562fb82011-05-09 11:01:31 -0700248 msg = 'Changelist description needs TEST field (after first line)'
249 return HookFailure(msg)
250
Ryan Cuiec4d6332011-05-02 14:15:25 -0700251
252def _check_change_has_bug_field(project, commit):
253 """Check for a non-empty 'BUG=' field in the commit message."""
Mandeep Singh Baines96a53be2011-05-03 11:10:25 -0700254 BUG_RE = r'\n\s*BUG\s*=[^\n]*\S+'
Ryan Cuiec4d6332011-05-02 14:15:25 -0700255
Mandeep Singh Baines96a53be2011-05-03 11:10:25 -0700256 if not re.search(BUG_RE, _get_commit_desc(commit)):
Ryan Cui1562fb82011-05-09 11:01:31 -0700257 msg = 'Changelist description needs BUG field (after first line)'
258 return HookFailure(msg)
259
Ryan Cuiec4d6332011-05-02 14:15:25 -0700260
Mandeep Singh Bainesa23eb5f2011-05-04 13:43:25 -0700261def _check_change_has_proper_changeid(project, commit):
262 """Verify that Change-ID is present in last paragraph of commit message."""
263 desc = _get_commit_desc(commit)
264 loc = desc.rfind('\nChange-Id:')
265 if loc == -1 or re.search('\n\s*\n\s*\S+', desc[loc:]):
Ryan Cui1562fb82011-05-09 11:01:31 -0700266 return HookFailure('Change-Id must be in last paragraph of description.')
267
Mandeep Singh Bainesa23eb5f2011-05-04 13:43:25 -0700268
Ryan Cuiec4d6332011-05-02 14:15:25 -0700269def _check_license(project, commit):
270 """Verifies the license header."""
271 LICENSE_HEADER = (
272 r".*? Copyright \(c\) 20[-0-9]{2,7} The Chromium OS Authors\. All rights "
273 r"reserved\." "\n"
274 r".*? Use of this source code is governed by a BSD-style license that can "
275 "be\n"
276 r".*? found in the LICENSE file\."
277 "\n"
278 )
279
280 license_re = re.compile(LICENSE_HEADER, re.MULTILINE)
281 bad_files = []
282 files = _filter_files(_get_affected_files(commit),
283 COMMON_INCLUDED_PATHS,
284 COMMON_EXCLUDED_PATHS)
285
286 for f in files:
287 contents = open(f).read()
288 if len(contents) == 0: continue # Ignore empty files
289 if not license_re.search(contents):
290 bad_files.append(f)
291 if bad_files:
Ryan Cui1562fb82011-05-09 11:01:31 -0700292 return HookFailure('License must match:\n%s\n' % license_re.pattern +
293 'Found a bad license header in these files:',
294 bad_files)
Ryan Cuiec4d6332011-05-02 14:15:25 -0700295
296
297# Project-specific hooks
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700298
Ryan Cui1562fb82011-05-09 11:01:31 -0700299
Mandeep Singh Bainesb9ed1402011-04-29 15:32:06 -0700300def _run_checkpatch(project, commit):
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700301 """Runs checkpatch.pl on the given project"""
302 hooks_dir = _get_hooks_dir()
303 cmd = ['%s/checkpatch.pl' % hooks_dir, '-']
304 p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
Mandeep Singh Bainesb9ed1402011-04-29 15:32:06 -0700305 output = p.communicate(_get_diff(commit))[0]
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700306 if p.returncode:
Ryan Cui1562fb82011-05-09 11:01:31 -0700307 return HookFailure('checkpatch.pl errors/warnings\n\n' + output)
Ryan Cuiec4d6332011-05-02 14:15:25 -0700308
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700309
Dale Curtis2975c432011-05-03 17:25:20 -0700310def _run_json_check(project, commit):
311 """Checks that all JSON files are syntactically valid."""
Dale Curtisa039cfd2011-05-04 12:01:05 -0700312 for f in _filter_files(_get_affected_files(commit), [r'.*\.json']):
Dale Curtis2975c432011-05-03 17:25:20 -0700313 try:
314 json.load(open(f))
315 except Exception, e:
Ryan Cui1562fb82011-05-09 11:01:31 -0700316 return HookFailure('Invalid JSON in %s: %s' % (f, e))
Dale Curtis2975c432011-05-03 17:25:20 -0700317
318
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700319# Base
320
Ryan Cui1562fb82011-05-09 11:01:31 -0700321
Ryan Cui9b651632011-05-11 11:38:58 -0700322# A list of hooks that are not project-specific
323_COMMON_HOOKS = [
324 _check_change_has_bug_field,
325 _check_change_has_test_field,
326 _check_change_has_proper_changeid,
327 _check_no_stray_whitespace,
328 _check_no_long_lines,
329 _check_license,
330 _check_no_tabs,
331]
Ryan Cuiec4d6332011-05-02 14:15:25 -0700332
Ryan Cui1562fb82011-05-09 11:01:31 -0700333
Ryan Cui9b651632011-05-11 11:38:58 -0700334# A dictionary of project-specific hooks(callbacks), indexed by project name.
335# dict[project] = [callback1, callback2]
336_PROJECT_SPECIFIC_HOOKS = {
Doug Anderson830216f2011-05-02 10:08:37 -0700337 "chromiumos/third_party/kernel": [_run_checkpatch],
338 "chromiumos/third_party/kernel-next": [_run_checkpatch],
Dale Curtis2975c432011-05-03 17:25:20 -0700339 "chromeos/autotest-tools": [_run_json_check],
Ryan Cui9b651632011-05-11 11:38:58 -0700340}
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700341
Ryan Cui1562fb82011-05-09 11:01:31 -0700342
Ryan Cui9b651632011-05-11 11:38:58 -0700343# A dictionary of flags (keys) that can appear in the config file, and the hook
344# that the flag disables (value)
345_DISABLE_FLAGS = {
346 'stray_whitespace_check': _check_no_stray_whitespace,
347 'long_line_check': _check_no_long_lines,
348 'cros_license_check': _check_license,
349 'tab_check': _check_no_tabs,
350}
351
352
353def _get_disabled_hooks():
354 """Returns a set of hooks disabled by the current project's config file.
355
356 Expects to be called within the project root.
357 """
358 SECTION = 'Hook Overrides'
359 config = ConfigParser.RawConfigParser()
360 try:
361 config.read(_CONFIG_FILE)
362 flags = config.options(SECTION)
363 except ConfigParser.Error:
364 return set([])
365
366 disable_flags = []
367 for flag in flags:
368 try:
369 if not config.getboolean(SECTION, flag): disable_flags.append(flag)
370 except ValueError as e:
371 msg = "Error parsing flag \'%s\' in %s file - " % (flag, _CONFIG_FILE)
372 print msg + str(e)
373
374 disabled_keys = set(_DISABLE_FLAGS.iterkeys()).intersection(disable_flags)
375 return set([_DISABLE_FLAGS[key] for key in disabled_keys])
376
377
378def _get_project_hooks(project):
379 """Returns a list of hooks that need to be run for a project.
380
381 Expects to be called from within the project root.
382 """
383 disabled_hooks = _get_disabled_hooks()
384 hooks = [hook for hook in _COMMON_HOOKS if hook not in disabled_hooks]
385
386 if project in _PROJECT_SPECIFIC_HOOKS:
387 hooks.extend(_PROJECT_SPECIFIC_HOOKS[project])
388
389 return hooks
390
391
392def _run_project_hooks(project):
Ryan Cui1562fb82011-05-09 11:01:31 -0700393 """For each project run its project specific hook from the hooks dictionary.
394
395 Args:
396 project: name of project to run hooks for.
Ryan Cui1562fb82011-05-09 11:01:31 -0700397
398 Returns:
399 Boolean value of whether any errors were ecountered while running the hooks.
400 """
Ryan Cui72834d12011-05-05 14:51:33 -0700401 proj_dir = _run_command(['repo', 'forall', project, '-c', 'pwd']).strip()
Ryan Cuiec4d6332011-05-02 14:15:25 -0700402 pwd = os.getcwd()
403 # hooks assume they are run from the root of the project
404 os.chdir(proj_dir)
405
Ryan Cuifa55df52011-05-06 11:16:55 -0700406 try:
407 commit_list = _get_commits()
Don Garrettdba548a2011-05-05 15:17:14 -0700408 except VerifyException as e:
Ryan Cui1562fb82011-05-09 11:01:31 -0700409 PrintErrorForProject(project, HookFailure(str(e)))
410 os.chdir(pwd)
411 return True
Ryan Cuifa55df52011-05-06 11:16:55 -0700412
Ryan Cui9b651632011-05-11 11:38:58 -0700413 hooks = _get_project_hooks(project)
Ryan Cui1562fb82011-05-09 11:01:31 -0700414 error_found = False
Ryan Cuifa55df52011-05-06 11:16:55 -0700415 for commit in commit_list:
Ryan Cui1562fb82011-05-09 11:01:31 -0700416 error_list = []
Ryan Cui9b651632011-05-11 11:38:58 -0700417 for hook in hooks:
Ryan Cui1562fb82011-05-09 11:01:31 -0700418 hook_error = hook(project, commit)
419 if hook_error:
420 error_list.append(hook_error)
421 error_found = True
422 if error_list:
423 PrintErrorsForCommit(project, commit, _get_commit_desc(commit),
424 error_list)
Don Garrettdba548a2011-05-05 15:17:14 -0700425
Ryan Cuiec4d6332011-05-02 14:15:25 -0700426 os.chdir(pwd)
Ryan Cui1562fb82011-05-09 11:01:31 -0700427 return error_found
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700428
Ryan Cui72834d12011-05-05 14:51:33 -0700429
Mandeep Singh Baines116ad102011-04-27 15:16:37 -0700430# Main
Mandeep Singh Baines69e470e2011-04-06 10:34:52 -0700431
Ryan Cui1562fb82011-05-09 11:01:31 -0700432
Anush Elangovan63afad72011-03-23 00:41:27 -0700433def main(project_list, **kwargs):
Ryan Cui1562fb82011-05-09 11:01:31 -0700434 found_error = False
435 for project in project_list:
Ryan Cui9b651632011-05-11 11:38:58 -0700436 if _run_project_hooks(project):
Ryan Cui1562fb82011-05-09 11:01:31 -0700437 found_error = True
438
439 if (found_error):
440 msg = ('Preupload failed due to errors in project(s). HINTS:\n'
Ryan Cui9b651632011-05-11 11:38:58 -0700441 '- To disable some source style checks, and for other hints, see '
442 '<checkout_dir>/src/repohooks/README\n'
443 '- To upload only current project, run \'repo upload .\'')
Ryan Cui1562fb82011-05-09 11:01:31 -0700444 print >> sys.stderr, msg
Don Garrettdba548a2011-05-05 15:17:14 -0700445 sys.exit(1)
Anush Elangovan63afad72011-03-23 00:41:27 -0700446
Ryan Cui1562fb82011-05-09 11:01:31 -0700447
Mandeep Singh Baines69e470e2011-04-06 10:34:52 -0700448if __name__ == '__main__':
449 main()