mirror of
https://github.com/qca/qca-swiss-army-knife.git
synced 2026-01-27 17:07:18 +01:00
ath10k-check: port to python3
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
This commit is contained in:
parent
105e81816d
commit
25a662da8a
1 changed files with 24 additions and 23 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2015-2017 Qualcomm Atheros, Inc.
|
||||
# Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
|
|
@ -25,10 +25,7 @@ import sys
|
|||
import argparse
|
||||
import re
|
||||
import tempfile
|
||||
try:
|
||||
import queue as Queue
|
||||
except ImportError:
|
||||
import Queue
|
||||
import queue
|
||||
import threading
|
||||
import string
|
||||
import hashlib
|
||||
|
|
@ -122,7 +119,7 @@ def run_gcc(args):
|
|||
|
||||
cmd = 'rm -f %s/*.o' % (DRIVER_DIR)
|
||||
logger.debug('%s' % cmd)
|
||||
subprocess.call(cmd, shell=True)
|
||||
subprocess.call(cmd, shell=True, universal_newlines=True)
|
||||
|
||||
cmd = ['make', '-k', '-j', str(threads)]
|
||||
|
||||
|
|
@ -140,7 +137,7 @@ def run_gcc(args):
|
|||
|
||||
logger.debug('%s' % cmd)
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
env=env)
|
||||
env=env, universal_newlines=True)
|
||||
(stdout, stderr) = p.communicate()
|
||||
|
||||
stderr = stderr.strip()
|
||||
|
|
@ -161,7 +158,8 @@ def run_sparse(args):
|
|||
cmd = ['make', '-k', '-j',
|
||||
str(threads), DRIVER_DIR, 'C=2', 'CF="-D__CHECK_ENDIAN__"']
|
||||
logger.debug('%s' % cmd)
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
(stdout, stderr) = p.communicate()
|
||||
|
||||
stderr = stderr.strip()
|
||||
|
|
@ -239,13 +237,13 @@ def run_checkpatch_cmd(args, q, tag_map):
|
|||
while True:
|
||||
try:
|
||||
f = q.get_nowait()
|
||||
except Queue.Empty:
|
||||
except queue.Empty:
|
||||
# no more files to check
|
||||
break
|
||||
|
||||
cmd = checkpatch_cmd + [f]
|
||||
p = subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
(stdoutdata, stderrdata) = p.communicate()
|
||||
|
||||
if stdoutdata is None:
|
||||
|
|
@ -269,7 +267,7 @@ def run_checkpatch_cmd(args, q, tag_map):
|
|||
def run_checkpatch(args):
|
||||
# get all files which need to be checked
|
||||
cmd = 'git ls-tree HEAD %s | cut -f 2' % (DRIVER_DIR)
|
||||
output = subprocess.check_output(cmd, shell=True)
|
||||
output = subprocess.check_output(cmd, shell=True, universal_newlines=True)
|
||||
driver_files = output.splitlines()
|
||||
|
||||
# drop files we need to ignore
|
||||
|
|
@ -290,7 +288,7 @@ def run_checkpatch(args):
|
|||
|
||||
cmd = 'gtags -f %s' % (tmpfilename)
|
||||
logger.debug('%s' % (cmd))
|
||||
output = subprocess.check_output(cmd, shell=True)
|
||||
output = subprocess.check_output(cmd, shell=True, universal_newlines=True)
|
||||
|
||||
os.remove(tmpfilename)
|
||||
|
||||
|
|
@ -304,7 +302,7 @@ def run_checkpatch(args):
|
|||
continue
|
||||
|
||||
cmd = 'global -f %s' % (f)
|
||||
output = subprocess.check_output(cmd, shell=True)
|
||||
output = subprocess.check_output(cmd, shell=True, universal_newlines=True)
|
||||
lines = output.splitlines()
|
||||
for l in lines:
|
||||
columns = l.split()
|
||||
|
|
@ -316,7 +314,7 @@ def run_checkpatch(args):
|
|||
|
||||
tag_map[f].append((line, tagname))
|
||||
|
||||
q = Queue.Queue()
|
||||
q = queue.Queue()
|
||||
|
||||
for f in driver_files:
|
||||
q.put(f)
|
||||
|
|
@ -342,33 +340,36 @@ def show_version(args):
|
|||
|
||||
run = subprocess.check_output
|
||||
|
||||
f = open(sys.argv[0], 'r')
|
||||
f = open(sys.argv[0], 'rb')
|
||||
ath10kcheck_md5sum = hashlib.md5(f.read()).hexdigest()
|
||||
f.close()
|
||||
|
||||
try:
|
||||
gcc_version = run(['gcc', '--version']).splitlines()[0]
|
||||
gcc_version = run(['gcc', '--version'],
|
||||
universal_newlines=True).splitlines()[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
sparse_version = run(['sparse', '--version']).splitlines()[0]
|
||||
sparse_version = run(['sparse', '--version'],
|
||||
universal_newlines=True).splitlines()[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
checkpatch_version = run(
|
||||
['checkpatch.pl', '--version']).splitlines()[1]
|
||||
checkpatch_version = run(['checkpatch.pl', '--version'],
|
||||
universal_newlines=True).splitlines()[1]
|
||||
path = distutils.spawn.find_executable(
|
||||
'checkpatch.pl', os.environ['PATH'])
|
||||
f = open(path, 'r')
|
||||
f = open(path, 'rb')
|
||||
checkpatch_md5sum = hashlib.md5(f.read()).hexdigest()
|
||||
f.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
gtags_version = run(['gtags', '--version']).splitlines()[0]
|
||||
gtags_version = run(['gtags', '--version'],
|
||||
universal_newlines=True).splitlines()[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
@ -468,7 +469,7 @@ $CHECKPATCH_CMDLINE
|
|||
checkpatch = True
|
||||
|
||||
try:
|
||||
cores = subprocess.check_output(['nproc'])
|
||||
cores = subprocess.check_output(['nproc'], universal_newlines=True)
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
cores = '4'
|
||||
logger.warning('Failed to run nproc, assuming %s cores' % (cores))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue