From 99adf6eda7bed1beb3fa3e18951342f67b108db7 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 9 Jan 2013 16:00:10 +0000 Subject: patman: Allow use outside of u-boot tree To make it usable in git trees not providing a patch checker implementation, add a command line option, allowing to suppress patch check. While we are at it, sort debug options alphabetically. Also, do not raise an exception if checkpatch.pl is not found - just print an error message suggesting to use the new option, and return nonzero status. . unit test passes: $ ./patman -t . successfully used patman in the autotest tree to generate a patch email (with --no-check option) . successfully used patman in the u-boot tree to generate a patch email . `patman --help' now shows command line options ordered alphabetically Signed-off-by: Vadim Bendebury Acked-by: Doug Anderson Acked-by: Simon Glass --- tools/patman/checkpatch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index f72f8ee261..d3a0477bbf 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -23,6 +23,7 @@ import command import gitutil import os import re +import sys import terminal def FindCheckPatch(): @@ -47,8 +48,10 @@ def FindCheckPatch(): if os.path.isfile(fname): return fname path = os.path.dirname(path) - print 'Could not find checkpatch.pl' - return None + + print >> sys.stderr, ('Cannot find checkpatch.pl - please put it in your ' + + '~/bin directory or use --no-check') + sys.exit(1) def CheckPatch(fname, verbose=False): """Run checkpatch.pl on a file. @@ -67,9 +70,6 @@ def CheckPatch(fname, verbose=False): error_count, warning_count, lines = 0, 0, 0 problems = [] chk = FindCheckPatch() - if not chk: - raise OSError, ('Cannot find checkpatch.pl - please put it in your ' + - '~/bin directory') item = {} stdout = command.Output(chk, '--no-tree', fname) #pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE) -- cgit v1.2.3