diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 16:04:21 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 16:04:21 +0000 |
commit | d458974c454ee977dc0bd3b9f1116df7d4037ab2 (patch) | |
tree | 31145842c1fd7a6a775c7f9c506af4bbc67eb9dd /clang/tools/scan-view/share/Reporter.py | |
parent | e9effe9744bda67051ab2ff0a76ecc9e99488efa (diff) | |
download | bcm5719-llvm-d458974c454ee977dc0bd3b9f1116df7d4037ab2.tar.gz bcm5719-llvm-d458974c454ee977dc0bd3b9f1116df7d4037ab2.zip |
Portable Python script across Python version
In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead.
The portability patch consists in forcing an extra `list` call if the result is actually used as a list.
`map` are replaced by list comprehension and `filter` by filtered list comprehension.
Differential Revision: https://reviews.llvm.org/D55197
llvm-svn: 349501
Diffstat (limited to 'clang/tools/scan-view/share/Reporter.py')
-rw-r--r-- | clang/tools/scan-view/share/Reporter.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/tools/scan-view/share/Reporter.py b/clang/tools/scan-view/share/Reporter.py index 7887636559b..b1ff16142e2 100644 --- a/clang/tools/scan-view/share/Reporter.py +++ b/clang/tools/scan-view/share/Reporter.py @@ -80,7 +80,7 @@ class EmailReporter(object): return 'Email' def getParameters(self): - return map(lambda x:TextParameter(x),['To', 'From', 'SMTP Server', 'SMTP Port']) + return [TextParameter(x) for x in ['To', 'From', 'SMTP Server', 'SMTP Port']] # Lifted from python email module examples. def attachFile(self, outer, path): @@ -148,7 +148,7 @@ class BugzillaReporter(object): return 'Bugzilla' def getParameters(self): - return map(lambda x:TextParameter(x),['URL','Product']) + return [TextParameter(x) for x in ['URL','Product']] def fileReport(self, report, parameters): raise NotImplementedError @@ -211,7 +211,7 @@ class RadarReporter(object): script = os.path.join(os.path.dirname(__file__),'../share/scan-view/FileRadar.scpt') args = ['osascript', script, component, componentVersion, classification, personID, report.title, - report.description, diagnosis, config] + map(os.path.abspath, report.files) + report.description, diagnosis, config] + [os.path.abspath(f) for f in report.files] # print >>sys.stderr, args try: p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |