diff --git a/.travis.yml b/.travis.yml index e4958fd90..53f3f6747 100644 --- a/.travis.yml +++ b/.travis.yml @@ -80,7 +80,7 @@ matrix: - python -m py_compile ./tools/donate-cpu.py - python3 -m py_compile ./tools/donate-cpu.py - python -m py_compile ./tools/donate-cpu-server.py - # donate-cpu-server.py is currently not Python 3 compatible + - python3 -m py_compile ./tools/donate-cpu-server.py # check addons/misra.py - cd addons/test - ${CPPCHECK} --dump misc-test.cpp diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index 3b23ea9e8..d3b2825e5 100644 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -12,6 +12,7 @@ import sys import urllib import logging import logging.handlers +import operator OLD_VERSION = '1.87' @@ -522,7 +523,7 @@ def check_library_report(result_path, message_id): function_counts[function_name] = function_counts.setdefault(function_name, 0) + 1 function_details_list = [] - for function_name, count in sorted(function_counts.iteritems(), key=lambda (k, v): (v, k), reverse=True): + for function_name, count in sorted(function_counts.items(), key=operator.itemgetter(1), reverse=True): if len(function_details_list) >= functions_shown_max: break function_details_list.append(str(count).rjust(column_widths[0]) + ' ' +