[SEBA-946]

Fix Swagger documentation generation, update to Python 3

Change-Id: I0a55c4805a993dcac9f0721be87bbefbf8b9b348
diff --git a/docs/scripts/swagger_docs.py b/docs/scripts/swagger_docs.py
index 7a01bc7..f22d1c2 100644
--- a/docs/scripts/swagger_docs.py
+++ b/docs/scripts/swagger_docs.py
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import print_function
+
 import os
 import traceback
 from xosgenx.generator import XOSProcessor, XOSProcessorArgs
@@ -23,13 +25,14 @@
 class Args:
     pass
 
+
 def generate_swagger_docs(xproto):
 
     # if not os.path.isfile(xproto):
     #     print "ERROR: Couldn't find xproto file for %s at: %s" % (service, xproto)
     #     return
 
-    print "Generating swagger docs for %s" % (xproto)
+    print("Generating swagger docs for %s" % (xproto))
     args = XOSProcessorArgs()
     args.files = xproto
     args.target = 'swagger.xtarget'
@@ -40,9 +43,10 @@
     try:
         XOSProcessor.process(args)
     except Exception:
-        print "ERROR: Couldn't generate swagger specs"
+        print("ERROR: Couldn't generate swagger specs")
         traceback.print_exc()
 
+
 def get_xproto_recursively(root):
     files = []
     items = os.listdir(root)
@@ -63,9 +67,7 @@
         elif os.path.isfile(item_abs_path) and ".xproto" in item_abs_path:
             files.append(item_abs_path)
 
-    protos = [f for f in files if "xproto" in f]
-
-    protos = sorted(protos)
+    protos = sorted([f for f in files if "xproto" in f])
 
     # remove the core xproto...
     core_proto = None
@@ -81,12 +83,6 @@
     return protos
 
 
-def main():
-
-    protos = get_xproto_recursively(REPO_DIR)
-
-    generate_swagger_docs(protos)
-
-
 if __name__ == '__main__':
-    main()
+    protos = get_xproto_recursively(REPO_DIR)
+    generate_swagger_docs(protos)