Support Python3 as well in gen_release_info.py
authorEric Werness <ewerness@nvidia.com>
Fri, 16 Nov 2018 21:50:40 +0000 (13:50 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 9 May 2019 15:08:08 +0000 (11:08 -0400)
The CMake file version check can end up picking python3 in some cases -
making the Python code compatible with python3 seems easier than
adjusting the version check.

Components: Frameworks
Change-Id: Iab37090ab813dcb7839490225ca2a4bf2f721c12
(cherry picked from commit f1bcdd5e9df1f83cc9dc4ef7235d3da16e9f7fab)

framework/qphelper/gen_release_info.py

index a3ee54c..11fc611 100644 (file)
@@ -26,13 +26,13 @@ import sys
 import argparse
 
 def readFile (filename):
-       f = open(filename, 'rb')
+       f = open(filename, 'rt')
        d = f.read()
        f.close()
        return d
 
 def writeFile (filename, data):
-       f = open(filename, 'wb')
+       f = open(filename, 'wt')
        f.write(data)
        f.close()
 
@@ -73,12 +73,12 @@ def parseArgs ():
        args = parser.parse_args()
 
        if (args.releaseName == None) != (args.releaseId == None):
-               print "Both --name and --id must be specified"
+               print("Both --name and --id must be specified")
                parser.print_help()
                sys.exit(-1)
 
        if (args.releaseName != None) == args.git:
-               print "Either --name and --id, or --git must be specified"
+               print("Either --name and --id, or --git must be specified")
                parser.print_help()
                sys.exit(-1)