Skip to content

Commit 30b20d1

Browse files
authored
donate-cpu: some cleanups (#4291)
* donate_cpu_lib.py: bumped version * donate-cpu.py: replaced `version.StrictVersion` from deprecated `distutils` with `version.Version` from `packaging` * donate_cpu_lib.py: omit `-rp=` from `cppcheck-options` * donate-cpu.py: use `get_client_version()` instead of constant
1 parent 7ee450e commit 30b20d1

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

tools/donate-cpu.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
import platform
3434

35-
from distutils.version import StrictVersion
35+
from packaging.version import Version
3636
from donate_cpu_lib import *
3737

3838
max_packages = None
@@ -263,7 +263,7 @@ def get_client_version_head():
263263
output = 'cppcheck-options: ' + cppcheck_options + '\n'
264264
output += 'platform: ' + platform.platform() + '\n'
265265
output += 'python: ' + platform.python_version() + '\n'
266-
output += 'client-version: ' + CLIENT_VERSION + '\n'
266+
output += 'client-version: ' + get_client_version() + '\n'
267267
output += 'compiler: ' + get_compiler_version() + '\n'
268268
output += 'cppcheck: ' + ' '.join(cppcheck_versions) + '\n'
269269
output += 'head-info: ' + cppcheck_head_info + '\n'
@@ -288,6 +288,6 @@ def get_client_version_head():
288288
upload_info(package, info_output, server_address)
289289
if not max_packages or packages_processed < max_packages:
290290
print('Sleep 5 seconds..')
291-
if (client_version_head is not None) and (StrictVersion(client_version_head) > StrictVersion(get_client_version())):
291+
if (client_version_head is not None) and (Version(client_version_head) > Version(get_client_version())):
292292
print("ATTENTION: A newer client version ({}) is available - please update!".format(client_version_head))
293293
time.sleep(5)

tools/donate_cpu_lib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
1616
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
1717
# changes)
18-
CLIENT_VERSION = "1.3.29"
18+
CLIENT_VERSION = "1.3.30"
1919

2020
# Timeout for analysis with Cppcheck in seconds
2121
CPPCHECK_TIMEOUT = 30 * 60
@@ -334,12 +334,12 @@ def scan_package(cppcheck_path, source_path, jobs, libraries, capture_callstack=
334334
# Reference for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
335335
options = libs + ' --showtime=top5 --check-library --inconclusive --enable=style,information --inline-suppr --template=daca2'
336336
options += ' -D__GNUC__ --platform=unix64'
337-
options += ' -rp={}'.format(dir_to_scan)
337+
options_rp = options + ' -rp={}'.format(dir_to_scan)
338338
if sys.platform == 'win32':
339-
cppcheck_cmd = os.path.join(cppcheck_path, 'bin', 'cppcheck.exe') + ' ' + options
339+
cppcheck_cmd = os.path.join(cppcheck_path, 'bin', 'cppcheck.exe') + ' ' + options_rp
340340
cmd = cppcheck_cmd + ' ' + jobs + ' ' + dir_to_scan
341341
else:
342-
cppcheck_cmd = os.path.join(cppcheck_path, 'cppcheck') + ' ' + options
342+
cppcheck_cmd = os.path.join(cppcheck_path, 'cppcheck') + ' ' + options_rp
343343
cmd = 'nice ' + cppcheck_cmd + ' ' + jobs + ' ' + dir_to_scan
344344
returncode, stdout, stderr, elapsed_time = __run_command(cmd)
345345

0 commit comments

Comments
 (0)