mirror of https://gitlab.com/ita1024/waf.git
Use splitlines when possible
This commit is contained in:
parent
340551d8a0
commit
80344dee5e
|
@ -22,7 +22,7 @@ file = open(name, 'r')
|
|||
txt = file.read()
|
||||
file.close()
|
||||
|
||||
lst = txt.split('\n')
|
||||
lst = txt.splitlines()
|
||||
for line in lst:
|
||||
source_filename = line.strip()
|
||||
if not source_filename: continue
|
||||
|
|
|
@ -35,7 +35,7 @@ def gtest_results(bld):
|
|||
|
||||
# uncomment if you want to see what's happening
|
||||
# print(str(out, 'utf-8'))
|
||||
output = str(out, 'utf-8').split('\n')
|
||||
output = str(out, 'utf-8').splitlines()
|
||||
for i, line in enumerate(output):
|
||||
if '[ RUN ]' in line and code:
|
||||
i += 1
|
||||
|
|
|
@ -1093,7 +1093,7 @@ def get_suncc_version(conf, cc):
|
|||
err = e.stderr
|
||||
|
||||
version = (out or err)
|
||||
version = version.split('\n')[0]
|
||||
version = version.splitlines()[0]
|
||||
|
||||
version_re = re.compile(r'cc:\s+sun\s+(c\+\+|c)\s+(?P<major>\d*)\.(?P<minor>\d*)', re.I).search
|
||||
match = version_re(version)
|
||||
|
|
|
@ -63,7 +63,7 @@ def get_gfortran_version(conf, fc):
|
|||
conf.fatal('Could not determine the compiler type')
|
||||
|
||||
k = {}
|
||||
out = out.split('\n')
|
||||
out = out.splitlines()
|
||||
import shlex
|
||||
|
||||
for line in out:
|
||||
|
|
|
@ -21,7 +21,7 @@ class ColorGCCFormatter(Logs.formatter):
|
|||
cmd = frame.f_locals['cmd']
|
||||
if isinstance(cmd, list) and ('gcc' in cmd[0] or 'g++' in cmd[0]):
|
||||
lines = []
|
||||
for line in rec.msg.split('\n'):
|
||||
for line in rec.msg.splitlines():
|
||||
if 'warning: ' in line:
|
||||
lines.append(self.colors.YELLOW + line)
|
||||
elif 'error: ' in line:
|
||||
|
|
|
@ -32,7 +32,7 @@ class RcvtFormatter(Logs.formatter):
|
|||
cmd = frame.f_locals['cmd']
|
||||
if isinstance(cmd, list) and ('armcc' in cmd[0] or 'armld' in cmd[0]):
|
||||
lines = []
|
||||
for line in rec.msg.split('\n'):
|
||||
for line in rec.msg.splitlines():
|
||||
if 'Warning: ' in line:
|
||||
lines.append(self.colors.YELLOW + line)
|
||||
elif 'Error: ' in line:
|
||||
|
|
|
@ -211,7 +211,7 @@ class cppcheck(Task.Task):
|
|||
'''use cppcheck xml result string, add the command string used to invoke cppcheck
|
||||
and save as xml file.
|
||||
'''
|
||||
header = '%s\n' % s.split('\n')[0]
|
||||
header = '%s\n' % s.splitlines()[0]
|
||||
root = ElementTree.fromstring(s)
|
||||
cmd = ElementTree.SubElement(root.find('cppcheck'), 'cmd')
|
||||
cmd.text = str(self.cmd)
|
||||
|
|
|
@ -41,7 +41,7 @@ def get_pgfortran_version(conf,fc):
|
|||
conf.fatal('Could not determine the compiler type')
|
||||
k = {}
|
||||
prevk = ''
|
||||
out = out.split('\n')
|
||||
out = out.splitlines()
|
||||
for line in out:
|
||||
lst = line.partition('=')
|
||||
if lst[1] == '=':
|
||||
|
|
|
@ -57,7 +57,7 @@ class protoc(Task):
|
|||
if node in seen:
|
||||
return
|
||||
seen.append(node)
|
||||
code = node.read().split("\n")
|
||||
code = node.read().splitlines()
|
||||
for line in code:
|
||||
m = re.search(r'^import\s+"(.*)";.*(//)?.*', line)
|
||||
if m:
|
||||
|
|
Loading…
Reference in New Issue