donate-cpu.py: Fix some PEP 8 and other warnings (#1579)
There should not be functional changes. Tested locally.
This commit is contained in:
parent
126bd2bb5d
commit
2b008b473a
|
@ -29,6 +29,7 @@ import time
|
||||||
import re
|
import re
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
|
|
||||||
def checkRequirements():
|
def checkRequirements():
|
||||||
result = True
|
result = True
|
||||||
for app in ['g++', 'git', 'make', 'wget']:
|
for app in ['g++', 'git', 'make', 'wget']:
|
||||||
|
@ -39,6 +40,7 @@ def checkRequirements():
|
||||||
result = False
|
result = False
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def getCppcheck(cppcheckPath):
|
def getCppcheck(cppcheckPath):
|
||||||
print('Get Cppcheck..')
|
print('Get Cppcheck..')
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
|
@ -115,7 +117,6 @@ def getPackage(server_address):
|
||||||
return package.decode('utf-8')
|
return package.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def handleRemoveReadonly(func, path, exc):
|
def handleRemoveReadonly(func, path, exc):
|
||||||
import stat
|
import stat
|
||||||
if not os.access(path, os.W_OK):
|
if not os.access(path, os.W_OK):
|
||||||
|
@ -260,6 +261,7 @@ def splitResults(results):
|
||||||
ret.append(w.strip())
|
ret.append(w.strip())
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def diffResults(workPath, ver1, results1, ver2, results2):
|
def diffResults(workPath, ver1, results1, ver2, results2):
|
||||||
print('Diff results..')
|
print('Diff results..')
|
||||||
ret = ''
|
ret = ''
|
||||||
|
@ -312,6 +314,7 @@ def uploadResults(package, results, server_address):
|
||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
jobs = '-j1'
|
jobs = '-j1'
|
||||||
stopTime = None
|
stopTime = None
|
||||||
workpath = os.path.expanduser('~/cppcheck-donate-cpu-workfolder')
|
workpath = os.path.expanduser('~/cppcheck-donate-cpu-workfolder')
|
||||||
|
@ -373,10 +376,10 @@ while True:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for ver in cppcheckVersions:
|
for ver in cppcheckVersions:
|
||||||
if ver == 'head':
|
if ver == 'head':
|
||||||
if compile(cppcheckPath, jobs) == False:
|
if not compile(cppcheckPath, jobs):
|
||||||
print('Failed to compile Cppcheck, retry later')
|
print('Failed to compile Cppcheck, retry later')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif compile_version(workpath, jobs, ver) == False:
|
elif not compile_version(workpath, jobs, ver):
|
||||||
print('Failed to compile Cppcheck-{}, retry later'.format(ver))
|
print('Failed to compile Cppcheck-{}, retry later'.format(ver))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if packageUrl:
|
if packageUrl:
|
||||||
|
@ -398,7 +401,7 @@ while True:
|
||||||
cppcheck = 'cppcheck/cppcheck'
|
cppcheck = 'cppcheck/cppcheck'
|
||||||
else:
|
else:
|
||||||
cppcheck = ver + '/cppcheck'
|
cppcheck = ver + '/cppcheck'
|
||||||
c,errout,t = scanPackage(workpath, cppcheck, jobs)
|
c, errout, t = scanPackage(workpath, cppcheck, jobs)
|
||||||
if c < 0:
|
if c < 0:
|
||||||
crash = True
|
crash = True
|
||||||
count += ' Crash!'
|
count += ' Crash!'
|
||||||
|
|
Loading…
Reference in New Issue