[SDFAB-1197] First stab to update ONOS to py3

Update has been performed only on the scripts and the
executables strictly necessary for the following use cases:

- Build (including Intellij)
- Tests (including Intellij)
- Docker build (including dev and yourkit)
- Upload snapshot (including local)
- Release

Finally, fix the ability to run ONOS using onos-local targets,
stc and docker stc (aka up4 stc env). Last but not least, updated
the azul image to a newer one which exports also the PYTHONENCODING

Change-Id: Ie96f3a9c76dbba83b1fc3896a372f1045d3d7ccc
diff --git a/tools/dev/bin/onos-gen-bazel-project b/tools/dev/bin/onos-gen-bazel-project
index 355193a..007a13a 100755
--- a/tools/dev/bin/onos-gen-bazel-project
+++ b/tools/dev/bin/onos-gen-bazel-project
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
 import os
 
 import subprocess
@@ -31,8 +31,9 @@
 
 def get_library_targets():
     this_dir = os.path.dirname(os.path.realpath(__file__))
+    # NOTE that here we depends on bazel generating utf-8 bytes
     out = subprocess.check_output([
-        "bazel", "query", "kind(\"java_library\", //...:all)"], cwd=this_dir)
+        "bazel", "query", "kind(\"java_library\", //...:all)"], cwd=this_dir, encoding='UTF-8')
     return out.strip().split("\n")
 
 
@@ -43,12 +44,12 @@
         "script_name": os.path.basename(__file__),
         "language_level": JAVA_LANGUAGE_LEVEL,
         "exclude_dirs": "\n".join(
-            map(lambda x: "  -" + x, EXCLUDE_DIRECTORIES)),
-        "targets": "\n".join(map(lambda x: "  " + x, all_targets)),
-        "test_sources": "\n".join(map(lambda x: "  " + x, TEST_SOURCES)),
+            ["  -" + x for x in EXCLUDE_DIRECTORIES]),
+        "targets": "\n".join(["  " + x for x in all_targets]),
+        "test_sources": "\n".join(["  " + x for x in TEST_SOURCES]),
     }
     return TEMPLATE.format(**data)
 
 
 if __name__ == "__main__":
-    print gen_project()
+    print(gen_project())