Improve python3 compatibility

Use proper print() function to make scripts compatible with both python
2 and 3. This paves the way to deprecating python 2 support altogether.

Change-Id: I80e5850a8978d78cda793e2192ef4bd3fd54a121
diff --git a/scripts/osmotestconfig.py b/scripts/osmotestconfig.py
index 2132c43..f227504 100644
--- a/scripts/osmotestconfig.py
+++ b/scripts/osmotestconfig.py
@@ -13,7 +13,7 @@
 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
+from __future__ import print_function
 import os
 import os.path
 import time
@@ -52,7 +52,7 @@
     try:
         cmd = app_desc[1].split(' ') + [ "-c", config]
         if verbose:
-            print "Verifying %s, test %s" % (' '.join(cmd), run_test.__name__)
+            print("Verifying %s, test %s" % (' '.join(cmd), run_test.__name__))
 
         proc = osmoutil.popen_devnull(cmd)
         end = app_desc[2]
@@ -61,10 +61,10 @@
         ret = run_test(vty)
 
     except IOError as se:
-        print >> sys.stderr, "Failed to verify %s" % ' '.join(cmd)
-        print >> sys.stderr, "Current directory: %s" % os.getcwd()
-        print >> sys.stderr, "Error was %s" % se
-        print >> sys.stderr, "Config was\n%s" % open(config).read()
+        print("Failed to verify %s" % ' '.join(cmd), file=sys.stderr)
+        print("Current directory: %s" % os.getcwd(), file=sys.stderr)
+        print("Error was %s" % se, file=sys.stderr)
+        print("Config was\n%s" % open(config).read(), file=sys.stderr)
         raise se
 
     finally:
@@ -125,9 +125,8 @@
 
             all_errs.append(err_lines)
 
-            print >> sys.stderr, \
-                "Documentation error (missing docs): \n%s\n%s\n" % (
-                cmd_line, '\n'.join(err_lines))
+            print("Documentation error (missing docs): \n%s\n%s\n" % (
+                cmd_line, '\n'.join(err_lines)), file=sys.stderr)
 
     return (len(all_errs), all_errs)
 
@@ -157,7 +156,7 @@
             if config in app_configs[app]:
                 found = True
         if not found:
-            print >> sys.stderr, "Warning: %s is not being tested" % config
+            print("Warning: %s is not being tested" % config, file=sys.stderr)
 
 
 def test_all_apps(apps, app_configs, tmpdir="writtenconfig", verbose=True,
@@ -166,7 +165,7 @@
     errors = 0
     for app in apps:
         if not app_exists(app):
-            print >> sys.stderr, "Skipping app %s (not found)" % app[1]
+            print("Skipping app %s (not found)" % app[1], file=sys.stderr)
             continue
 
         configs = app_configs[app[3]]
@@ -178,7 +177,7 @@
         remove_tmpdir(tmpdir)
 
     if errors:
-        print >> sys.stderr, "ERRORS: %d" % errors
+        print("ERRORS: %d" % errors, file=sys.stderr)
     return errors