]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
patman: Don't run patman when it is imported as a module
authorSimon Glass <sjg@chromium.org>
Thu, 30 Jul 2015 19:47:41 +0000 (13:47 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 31 Jul 2015 13:31:12 +0000 (07:31 -0600)
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 <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
tools/patman/patman.py

index e76fc42dd1973108809b9c35f4bb04cc7b793f4d..6fe8fe068c36f5028c1ccb3ed65fc994450c11a6 100755 (executable)
@@ -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]]