Fix Python3 Errors for Release Automation 43/54343/1
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Thu, 22 Mar 2018 20:40:22 +0000 (13:40 -0700)
committerTrevor Bramwell <tbramwell@linuxfoundation.org>
Thu, 22 Mar 2018 20:40:22 +0000 (13:40 -0700)
My testing was done using Python 2.7 but the build server running the
jobs is obviously running Python3.

These changes allow the create_branch.py release script to run against
both Python2 and Python3.

Change-Id: I02478986ef869ce82ece5b96dbb4b5ed548a2a55
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
releases/scripts/create_branch.py

index 8de1309..362aaaf 100644 (file)
@@ -12,7 +12,12 @@ Create Gerrit Branchs
 """
 
 import argparse
-import ConfigParser
+
+try:
+    import ConfigParser
+except ImportError:
+    import configparser as ConfigParser
+
 import logging
 import os
 import yaml
@@ -105,7 +110,7 @@ def main():
 
     try:
         auth = GerritAuth(url=gerrit_url)
-    except ValueError, err:
+    except ValueError as err:
         logging.error("%s for %s", err, gerrit_url)
         quit(1)
     restapi = GerritRestAPI(url=gerrit_url, auth=auth)