buildman: Fix problem with non-existent output directories
[oweals/u-boot.git] / tools / buildman / buildman.py
index d0afeda6c07734a7d7505757a437818a3ed25df7..30a8690f9352ce9620f05dc386768ec1bc11fe48 100755 (executable)
@@ -1,12 +1,13 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (c) 2012 The Chromium OS Authors.
 #
-# SPDX-License-Identifier:     GPL-2.0+
-#
 
 """See README for more information"""
 
+from __future__ import print_function
+
 import multiprocessing
 import os
 import re
@@ -15,7 +16,7 @@ import unittest
 
 # Bring in the patman libraries
 our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../patman'))
+sys.path.insert(1, os.path.join(our_path, '../patman'))
 
 # Our modules
 import board
@@ -30,7 +31,7 @@ import patchstream
 import terminal
 import toolchain
 
-def RunTests():
+def RunTests(skip_net_tests):
     import func_test
     import test
     import doctest
@@ -41,22 +42,24 @@ def RunTests():
         suite.run(result)
 
     sys.argv = [sys.argv[0]]
+    if skip_net_tests:
+        test.use_network = False
     for module in (test.TestBuild, func_test.TestFunctional):
         suite = unittest.TestLoader().loadTestsFromTestCase(module)
         suite.run(result)
 
-    print result
+    print(result)
     for test, err in result.errors:
-        print err
+        print(err)
     for test, err in result.failures:
-        print err
+        print(err)
 
 
 options, args = cmdline.ParseArgs()
 
 # Run our meagre tests
 if options.test:
-    RunTests()
+    RunTests(options.skip_net_tests)
 
 # Build selected commits for selected boards
 else: