From: Simon Glass Date: Thu, 30 Jul 2015 19:47:41 +0000 (-0600) Subject: patman: Don't run patman when it is imported as a module X-Git-Tag: v2015.10-rc1~4^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9649e152cbdd98d836912c45acd1f03fc70a21a5;p=oweals%2Fu-boot.git patman: Don't run patman when it is imported as a module Commit 488d19c (patman: add distutils based installer) has the side effect of making patman run twice with each invocation. Fix this by checking for 'main program' invocation in patman.py. This is good practice in any case. Signed-off-by: Simon Glass Reviewed-by: Chris Packham --- diff --git a/tools/patman/patman.py b/tools/patman/patman.py index e76fc42dd1..6fe8fe068c 100755 --- a/tools/patman/patman.py +++ b/tools/patman/patman.py @@ -74,8 +74,11 @@ specified by tags you place in the commits. Use -n to do a dry run first.""" settings.Setup(parser, options.project, '') (options, args) = parser.parse_args() +if __name__ != "__main__": + pass + # Run our meagre tests -if options.test: +elif options.test: import doctest sys.argv = [sys.argv[0]]