diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:36:33 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:36:33 +0000 |
commit | c0ebe773cd0fb301474430205c69440f9915d5b0 (patch) | |
tree | 15c98a08b79b0dddbfeea4f95372771ba44d4dd1 /clang/utils/analyzer/SATestUpdateDiffs.py | |
parent | 85833393d0e588f6d7613567db9c212236e3f0eb (diff) | |
download | bcm5719-llvm-c0ebe773cd0fb301474430205c69440f9915d5b0.tar.gz bcm5719-llvm-c0ebe773cd0fb301474430205c69440f9915d5b0.zip |
Portable Python script across Python version
Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.
Differential Revision: https://reviews.llvm.org/D55213
llvm-svn: 349454
Diffstat (limited to 'clang/utils/analyzer/SATestUpdateDiffs.py')
-rwxr-xr-x | clang/utils/analyzer/SATestUpdateDiffs.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/utils/analyzer/SATestUpdateDiffs.py b/clang/utils/analyzer/SATestUpdateDiffs.py index 3f1aafa690e..64e6ca43db3 100755 --- a/clang/utils/analyzer/SATestUpdateDiffs.py +++ b/clang/utils/analyzer/SATestUpdateDiffs.py @@ -3,6 +3,7 @@ """ Update reference results for static analyzer. """ +from __future__ import print_function import SATestBuild @@ -15,7 +16,7 @@ Verbose = 0 def runCmd(Command, **kwargs): if Verbose: - print "Executing %s" % Command + print("Executing %s" % Command) check_call(Command, shell=True, **kwargs) @@ -30,8 +31,8 @@ def updateReferenceResults(ProjName, ProjBuildMode): SATestBuild.getSBOutputDirName(IsReferenceBuild=False)) if not os.path.exists(CreatedResultsPath): - print >> sys.stderr, "New results not found, was SATestBuild.py "\ - "previously run?" + print("New results not found, was SATestBuild.py "\ + "previously run?", file=sys.stderr) sys.exit(1) BuildLogPath = SATestBuild.getBuildLogPath(RefResultsPath) @@ -62,9 +63,9 @@ def updateReferenceResults(ProjName, ProjBuildMode): def main(argv): if len(argv) == 2 and argv[1] in ('-h', '--help'): - print >> sys.stderr, "Update static analyzer reference results based "\ + print("Update static analyzer reference results based "\ "\non the previous run of SATestBuild.py.\n"\ - "\nN.B.: Assumes that SATestBuild.py was just run" + "\nN.B.: Assumes that SATestBuild.py was just run", file=sys.stderr) sys.exit(1) with SATestBuild.projectFileHandler() as f: |