donate-cpu/test-my-pr: Minor fixes (PEP 8, old Python 2 code, ...) (#2499)
* donate-cpu/test-my-pr: Minor fixes (PEP 8, old Python 2 code, ...) * test-my-pr.py: Add Python 3 shebang
This commit is contained in:
parent
9f26e8a356
commit
d8e0f40663
|
@ -150,7 +150,7 @@ while True:
|
|||
sys.exit(1)
|
||||
for ver in cppcheck_versions:
|
||||
if ver == 'head':
|
||||
if not compile(cppcheck_path, jobs):
|
||||
if not compile_cppcheck(cppcheck_path, jobs):
|
||||
print('Failed to compile Cppcheck, retry later')
|
||||
sys.exit(1)
|
||||
elif not compile_version(work_path, jobs, ver):
|
||||
|
|
|
@ -13,7 +13,7 @@ import tarfile
|
|||
# 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.1.41"
|
||||
CLIENT_VERSION = "1.1.42"
|
||||
|
||||
|
||||
def check_requirements():
|
||||
|
@ -88,7 +88,7 @@ def compile_version(work_path, jobs, version):
|
|||
return True
|
||||
|
||||
|
||||
def compile(cppcheck_path, jobs):
|
||||
def compile_cppcheck(cppcheck_path, jobs):
|
||||
print('Compiling Cppcheck..')
|
||||
try:
|
||||
os.chdir(cppcheck_path)
|
||||
|
@ -237,12 +237,6 @@ def has_include(path, includes):
|
|||
else:
|
||||
f = open(filename, 'rt', errors='ignore')
|
||||
filedata = f.read()
|
||||
try:
|
||||
# Python2 needs to decode the data first
|
||||
filedata = filedata.decode(encoding='utf-8', errors='ignore')
|
||||
except AttributeError:
|
||||
# Python3 directly reads the data into a string object that has no decode()
|
||||
pass
|
||||
f.close()
|
||||
if re.search(re_expr, filedata, re.MULTILINE):
|
||||
return True
|
||||
|
@ -393,13 +387,13 @@ def diff_results(work_path, ver1, results1, ver2, results2):
|
|||
|
||||
|
||||
def send_all(connection, data):
|
||||
bytes = data.encode('ascii', 'ignore')
|
||||
while bytes:
|
||||
num = connection.send(bytes)
|
||||
if num < len(bytes):
|
||||
bytes = bytes[num:]
|
||||
bytes_ = data.encode('ascii', 'ignore')
|
||||
while bytes_:
|
||||
num = connection.send(bytes_)
|
||||
if num < len(bytes_):
|
||||
bytes_ = bytes_[num:]
|
||||
else:
|
||||
bytes = None
|
||||
bytes_ = None
|
||||
|
||||
|
||||
def upload_results(package, results, server_address):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Run this script from your branch with proposed Cppcheck patch to verify your
|
||||
# patch against current master. It will compare output of testing bunch of
|
||||
|
@ -49,12 +50,12 @@ if __name__ == "__main__":
|
|||
print('Failed to switch to common ancestor of your branch and master')
|
||||
sys.exit(1)
|
||||
|
||||
if not lib.compile(master_dir, jobs):
|
||||
if not lib.compile_cppcheck(master_dir, jobs):
|
||||
print('Failed to compile master of Cppcheck')
|
||||
sys.exit(1)
|
||||
|
||||
print('Testing your PR from directory: ' + your_repo_dir)
|
||||
if not lib.compile(your_repo_dir, jobs):
|
||||
if not lib.compile_cppcheck(your_repo_dir, jobs):
|
||||
print('Failed to compile your version of Cppcheck')
|
||||
sys.exit(1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue