support: fix flake8 error E741 ambiguous variable name

A recent update of flake8 in CI introduced a new check E741. It
basically checks that variables are at least 3 characters long. Up to
now, however, we have used shorter names in some places - all of them
turn out to be "l" for a line of text.

Replace all those "l" variables with "line".

Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1687009829
partially:
support/scripts/boot-qemu-image.py:47:21: E741 ambiguous variable name 'l'
support/scripts/check-dotconfig.py:20:38: E741 ambiguous variable name 'l'
support/scripts/size-stats:76:13: E741 ambiguous variable name 'l'
support/testing/tests/core/test_bad_arch.py:17:32: E741 ambiguous variable name 'l'
support/testing/tests/package/test_python_treq.py:10:30: E741 ambiguous variable name 'l'
support/testing/tests/toolchain/test_external.py:30:42: E741 ambiguous variable name 'l'

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Arnout Vandecappelle (Essensium/Mind) 2021-10-18 21:58:22 +02:00 committed by Yann E. MORIN
parent 1217817ac2
commit d721c95b8b
6 changed files with 9 additions and 9 deletions

View File

@ -43,9 +43,9 @@ def main():
# In this case, spawn above will succeed at starting the wrapper # In this case, spawn above will succeed at starting the wrapper
# start-qemu.sh, but that one will fail (exit with 127) in such # start-qemu.sh, but that one will fail (exit with 127) in such
# a situation. # a situation.
exit = [int(l.split(' ')[1]) exit = [int(line.split(' ')[1])
for l in e.value.splitlines() for line in e.value.splitlines()
if l.startswith('exitstatus: ')] if line.startswith('exitstatus: ')]
if len(exit) and exit[0] == 127: if len(exit) and exit[0] == 127:
print('qemu-start.sh could not find the qemu binary') print('qemu-start.sh could not find the qemu binary')
sys.exit(0) sys.exit(0)

View File

@ -17,7 +17,7 @@ def main():
# strip() to get rid of trailing \n # strip() to get rid of trailing \n
with open(configfile) as configf: with open(configfile) as configf:
configlines = [l.strip() for l in configf.readlines()] configlines = [line.strip() for line in configf.readlines()]
defconfiglines = [] defconfiglines = []
with open(defconfig) as defconfigf: with open(defconfig) as defconfigf:

View File

@ -73,8 +73,8 @@ def add_file(filesdict, relpath, abspath, pkg):
def build_package_dict(builddir): def build_package_dict(builddir):
filesdict = {} filesdict = {}
with open(os.path.join(builddir, "build", "packages-file-list.txt")) as f: with open(os.path.join(builddir, "build", "packages-file-list.txt")) as f:
for l in f.readlines(): for line in f.readlines():
pkg, fpath = l.split(",", 1) pkg, fpath = line.split(",", 1)
# remove the initial './' in each file path # remove the initial './' in each file path
fpath = fpath.strip()[2:] fpath = fpath.strip()[2:]
fullpath = os.path.join(builddir, "target", fpath) fullpath = os.path.join(builddir, "target", fpath)

View File

@ -14,5 +14,5 @@ class DetectBadArchTest(infra.basetest.BRConfigTest):
if logf_path: if logf_path:
s = 'ERROR: architecture for "/usr/bin/foo" is' s = 'ERROR: architecture for "/usr/bin/foo" is'
with open(logf_path, "r") as f: with open(logf_path, "r") as f:
lines = [l for l in f.readlines() if l.startswith(s)] lines = [line for line in f.readlines() if line.startswith(s)]
self.assertEqual(len(lines), 1) self.assertEqual(len(lines), 1)

View File

@ -7,7 +7,7 @@ class TestPythonTreq(TestPythonPackageBase):
def run_sample_scripts(self): def run_sample_scripts(self):
cmd = self.interpreter + " sample_python_treq.py" cmd = self.interpreter + " sample_python_treq.py"
output, exit_code = self.emulator.run(cmd, timeout=20) output, exit_code = self.emulator.run(cmd, timeout=20)
refuse_msgs = [1 for l in output if "Connection refused" in l] refuse_msgs = [1 for line in output if "Connection refused" in line]
self.assertGreater(sum(refuse_msgs), 0) self.assertGreater(sum(refuse_msgs), 0)
self.assertEqual(exit_code, 0) self.assertEqual(exit_code, 0)

View File

@ -27,7 +27,7 @@ class TestExternalToolchain(infra.basetest.BRTest):
self.assertFalse(has_broken_links(path)) self.assertFalse(has_broken_links(path))
with open(os.path.join(self.builddir, ".config"), 'r') as configf: with open(os.path.join(self.builddir, ".config"), 'r') as configf:
configlines = [l.strip() for l in configf.readlines()] configlines = [line.strip() for line in configf.readlines()]
if "BR2_BINFMT_ELF=y" in configlines: if "BR2_BINFMT_ELF=y" in configlines:
interp = infra.get_elf_prog_interpreter(self.builddir, interp = infra.get_elf_prog_interpreter(self.builddir,