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
This commit is contained in:
Oliver Stöneberg 2022-07-19 07:52:23 +02:00 committed by GitHub
parent 7ee450ed21
commit 30b20d17cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@
import platform
from distutils.version import StrictVersion
from packaging.version import Version
from donate_cpu_lib import *
max_packages = None
@ -263,7 +263,7 @@ while True:
output = 'cppcheck-options: ' + cppcheck_options + '\n'
output += 'platform: ' + platform.platform() + '\n'
output += 'python: ' + platform.python_version() + '\n'
output += 'client-version: ' + CLIENT_VERSION + '\n'
output += 'client-version: ' + get_client_version() + '\n'
output += 'compiler: ' + get_compiler_version() + '\n'
output += 'cppcheck: ' + ' '.join(cppcheck_versions) + '\n'
output += 'head-info: ' + cppcheck_head_info + '\n'
@ -288,6 +288,6 @@ while True:
upload_info(package, info_output, server_address)
if not max_packages or packages_processed < max_packages:
print('Sleep 5 seconds..')
if (client_version_head is not None) and (StrictVersion(client_version_head) > StrictVersion(get_client_version())):
if (client_version_head is not None) and (Version(client_version_head) > Version(get_client_version())):
print("ATTENTION: A newer client version ({}) is available - please update!".format(client_version_head))
time.sleep(5)

View File

@ -15,7 +15,7 @@ import shlex
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
CLIENT_VERSION = "1.3.29"
CLIENT_VERSION = "1.3.30"
# Timeout for analysis with Cppcheck in seconds
CPPCHECK_TIMEOUT = 30 * 60
@ -334,12 +334,12 @@ def scan_package(cppcheck_path, source_path, jobs, libraries, capture_callstack=
# Reference for GNU C: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
options = libs + ' --showtime=top5 --check-library --inconclusive --enable=style,information --inline-suppr --template=daca2'
options += ' -D__GNUC__ --platform=unix64'
options += ' -rp={}'.format(dir_to_scan)
options_rp = options + ' -rp={}'.format(dir_to_scan)
if sys.platform == 'win32':
cppcheck_cmd = os.path.join(cppcheck_path, 'bin', 'cppcheck.exe') + ' ' + options
cppcheck_cmd = os.path.join(cppcheck_path, 'bin', 'cppcheck.exe') + ' ' + options_rp
cmd = cppcheck_cmd + ' ' + jobs + ' ' + dir_to_scan
else:
cppcheck_cmd = os.path.join(cppcheck_path, 'cppcheck') + ' ' + options
cppcheck_cmd = os.path.join(cppcheck_path, 'cppcheck') + ' ' + options_rp
cmd = 'nice ' + cppcheck_cmd + ' ' + jobs + ' ' + dir_to_scan
returncode, stdout, stderr, elapsed_time = __run_command(cmd)