aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/cmdline.py2
-rw-r--r--tools/binman/control.py6
-rw-r--r--tools/binman/elf_test.py13
-rw-r--r--tools/binman/entry.py2
-rw-r--r--tools/binman/entry_test.py7
-rw-r--r--tools/binman/etype/blob_dtb.py3
-rw-r--r--tools/binman/etype/blob_phase.py3
-rw-r--r--tools/binman/etype/cbfs.py3
-rw-r--r--tools/binman/etype/fdtmap.py5
-rw-r--r--tools/binman/etype/files.py2
-rw-r--r--tools/binman/etype/section.py1
-rw-r--r--tools/binman/etype/u_boot_dtb_with_ucode.py3
-rw-r--r--tools/binman/ftest.py21
-rw-r--r--tools/buildman/bsettings.py1
-rw-r--r--tools/buildman/builder.py2
-rw-r--r--tools/buildman/cfgutil.py6
-rw-r--r--tools/buildman/func_test.py6
-rw-r--r--tools/buildman/kconfiglib.py1
-rwxr-xr-xtools/buildman/main.py4
-rw-r--r--tools/concurrencytest/__init__.py0
-rwxr-xr-xtools/dtoc/test_dtoc.py6
-rwxr-xr-xtools/dtoc/test_fdt.py6
-rwxr-xr-xtools/moveconfig.py5
-rw-r--r--tools/patman/checkpatch.py4
-rw-r--r--tools/patman/command.py8
-rw-r--r--tools/patman/commit.py2
-rw-r--r--tools/patman/cros_subprocess.py18
-rw-r--r--tools/patman/func_test.py10
-rw-r--r--tools/patman/patchstream.py2
-rw-r--r--tools/patman/series.py3
-rw-r--r--tools/patman/settings.py4
-rw-r--r--tools/patman/tools.py10
32 files changed, 82 insertions, 87 deletions
diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index 0626b85..1d1ca43 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -7,7 +7,7 @@
import argparse
from argparse import ArgumentParser
-import state
+from binman import state
def make_extract_parser(subparsers):
"""make_extract_parser: Make a subparser for the 'extract' command
diff --git a/tools/binman/control.py b/tools/binman/control.py
index a179f78..c9d7a08 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -20,6 +20,10 @@ from binman import elf
from patman import command
from patman import tout
+# These are imported if needed since they import libfdt
+state = None
+Image = None
+
# List of images we plan to create
# Make this global so that it can be referenced from tests
images = OrderedDict()
@@ -41,6 +45,8 @@ def _ReadImageDesc(binman_node, use_expanded):
Returns:
OrderedDict of Image objects, each of which describes an image
"""
+ # For Image()
+ # pylint: disable=E1102
images = OrderedDict()
if 'multiple-images' in binman_node.props:
for node in binman_node.subnodes:
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index a67915b..5084838 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -116,7 +116,7 @@ class TestElf(unittest.TestCase):
entry = FakeEntry(10)
section = FakeSection()
with self.assertRaises(ValueError) as e:
- syms = elf.LookupAndWriteSymbols('missing-file', entry, section)
+ elf.LookupAndWriteSymbols('missing-file', entry, section)
self.assertIn("Filename 'missing-file' not found in input path",
str(e.exception))
@@ -126,7 +126,7 @@ class TestElf(unittest.TestCase):
section = FakeSection()
elf_fname = self.ElfTestFile('u_boot_binman_syms')
with self.assertRaises(ValueError) as e:
- syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertIn('entry_path has offset 4 (size 8) but the contents size '
'is a', str(e.exception))
@@ -139,8 +139,7 @@ class TestElf(unittest.TestCase):
entry = FakeEntry(10)
section = FakeSection()
elf_fname = self.ElfTestFile('u_boot_binman_syms_bad')
- self.assertEqual(elf.LookupAndWriteSymbols(elf_fname, entry, section),
- None)
+ elf.LookupAndWriteSymbols(elf_fname, entry, section)
def testBadSymbolSize(self):
"""Test that an attempt to use an 8-bit symbol are detected
@@ -152,7 +151,7 @@ class TestElf(unittest.TestCase):
section = FakeSection()
elf_fname =self.ElfTestFile('u_boot_binman_syms_size')
with self.assertRaises(ValueError) as e:
- syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertIn('has size 1: only 4 and 8 are supported',
str(e.exception))
@@ -165,7 +164,7 @@ class TestElf(unittest.TestCase):
entry = FakeEntry(24)
section = FakeSection(sym_value=None)
elf_fname = self.ElfTestFile('u_boot_binman_syms')
- syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertEqual(tools.get_bytes(255, 20) + tools.get_bytes(ord('a'), 4),
entry.data)
@@ -177,7 +176,7 @@ class TestElf(unittest.TestCase):
section = FakeSection()
elf_fname = self.ElfTestFile('u_boot_binman_syms')
with test_util.capture_sys_output() as (stdout, stderr):
- syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertTrue(len(stdout.getvalue()) > 0)
finally:
tout.init(tout.WARNING)
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index bf68a85..85dc339 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -19,6 +19,8 @@ from patman import tout
modules = {}
+# This is imported if needed
+state = None
# An argument which can be passed to entries on the command line, in lieu of
# device-tree properties.
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 7ed9b26..1d60076 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -5,6 +5,7 @@
# Test for the Entry class
import collections
+import importlib
import os
import sys
import unittest
@@ -32,11 +33,7 @@ class TestEntry(unittest.TestCase):
def _ReloadEntry(self):
global entry
if entry:
- if sys.version_info[0] >= 3:
- import importlib
- importlib.reload(entry)
- else:
- reload(entry)
+ importlib.reload(entry)
else:
from binman import entry
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index 3ce7511..4159e30 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -8,6 +8,9 @@
from binman.entry import Entry
from binman.etype.blob import Entry_blob
+# This is imported if needed
+state = None
+
class Entry_blob_dtb(Entry_blob):
"""A blob that holds a device tree
diff --git a/tools/binman/etype/blob_phase.py b/tools/binman/etype/blob_phase.py
index ed25e46..23e2ad6 100644
--- a/tools/binman/etype/blob_phase.py
+++ b/tools/binman/etype/blob_phase.py
@@ -7,6 +7,9 @@
from binman.etype.section import Entry_section
+# This is imported if needed
+state = None
+
class Entry_blob_phase(Entry_section):
"""Section that holds a phase binary
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index cc1fbdf..4a1837f 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -12,6 +12,9 @@ from binman.cbfs_util import CbfsWriter
from binman.entry import Entry
from dtoc import fdt_util
+# This is imported if needed
+state = None
+
class Entry_cbfs(Entry):
"""Coreboot Filesystem (CBFS)
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index 76e8dbe..33c9d03 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -15,6 +15,11 @@ from patman import tout
FDTMAP_MAGIC = b'_FDTMAP_'
FDTMAP_HDR_LEN = 16
+# These is imported if needed
+Fdt = None
+libfdt = None
+state = None
+
def LocateFdtmap(data):
"""Search an image for an fdt map
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
index 0650a69..13838ec 100644
--- a/tools/binman/etype/files.py
+++ b/tools/binman/etype/files.py
@@ -13,6 +13,8 @@ from binman.etype.section import Entry_section
from dtoc import fdt_util
from patman import tools
+# This is imported if needed
+state = None
class Entry_files(Entry_section):
"""A set of files arranged in a section
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 2515907..639b12d 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -163,6 +163,7 @@ class Entry_section(Entry):
self._sort = False
self._skip_at_start = None
self._end_4gb = False
+ self._ignore_missing = False
def ReadNode(self):
"""Read properties from the section node"""
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 554b3b2..047d310 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -9,6 +9,9 @@ from binman.entry import Entry
from binman.etype.blob_dtb import Entry_blob_dtb
from patman import tools
+# This is imported if needed
+state = None
+
class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
"""A U-Boot device tree file, with the microcode removed
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 8f00db6..8d41ab6 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -991,7 +991,7 @@ class TestFunctional(unittest.TestCase):
self.assertIn("Section '/binman': Size 0x7 (7) does not match "
"align-size 0x8 (8)", str(e.exception))
- def testPackAlignPowerOf2(self):
+ def testPackAlignPowerOf2Inv(self):
"""Test that invalid image alignment is detected"""
with self.assertRaises(ValueError) as e:
self._DoTestFile('020_pack_inv_image_align_power2.dts')
@@ -3714,7 +3714,7 @@ class TestFunctional(unittest.TestCase):
err = stderr.getvalue()
self.assertRegex(err, "Image 'main-section'.*missing.*: intel-ifwi")
- def testPackOverlap(self):
+ def testPackOverlapZero(self):
"""Test that zero-size overlapping regions are ignored"""
self._DoTestFile('160_pack_overlap_zero.dts')
@@ -4095,13 +4095,6 @@ class TestFunctional(unittest.TestCase):
self.assertIn("Generator node requires 'fit,fdt-list' property",
str(e.exception))
- def testFitFdtEmptyList(self):
- """Test handling of an empty 'of-list' entry arg"""
- entry_args = {
- 'of-list': '',
- }
- data = self._DoReadFileDtb('170_fit_fdt.dts', entry_args=entry_args)[0]
-
def testFitFdtMissing(self):
"""Test handling of a missing 'default-dt' entry arg"""
entry_args = {
@@ -4986,16 +4979,6 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
self.assertEqual('rot-cert', fent.fip_type)
self.assertEqual(b'aa', fent.data)
- def testFipOther(self):
- """Basic FIP with something that isn't a external blob"""
- data = self._DoReadFile('204_fip_other.dts')
- hdr, fents = fip_util.decode_fip(data)
-
- self.assertEqual(2, len(fents))
- fent = fents[1]
- self.assertEqual('rot-cert', fent.fip_type)
- self.assertEqual(b'aa', fent.data)
-
def testFipNoType(self):
"""FIP with an entry of an unknown type"""
with self.assertRaises(ValueError) as e:
diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
index 0b7208d..e634bbb 100644
--- a/tools/buildman/bsettings.py
+++ b/tools/buildman/bsettings.py
@@ -74,6 +74,7 @@ def CreateBuildmanConfigFile(config_fname):
print('''[toolchain]
# name = path
# e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux
+other = /
[toolchain-prefix]
# name = path to prefix
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 754642d..ecbfa3e 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1763,7 +1763,7 @@ class Builder:
if self.num_threads:
self.queue.put(job)
else:
- results = self._single_builder.RunJob(job)
+ self._single_builder.RunJob(job)
if self.num_threads:
term = threading.Thread(target=self.queue.join)
diff --git a/tools/buildman/cfgutil.py b/tools/buildman/cfgutil.py
index 4eba508..ab74a8e 100644
--- a/tools/buildman/cfgutil.py
+++ b/tools/buildman/cfgutil.py
@@ -123,10 +123,10 @@ def adjust_cfg_file(fname, adjust_cfg):
C=val to set the value of C (val must have quotes if C is
a string Kconfig)
"""
- lines = tools.ReadFile(fname, binary=False).splitlines()
+ lines = tools.read_file(fname, binary=False).splitlines()
out_lines = adjust_cfg_lines(lines, adjust_cfg)
out = '\n'.join(out_lines) + '\n'
- tools.WriteFile(fname, out, binary=False)
+ tools.write_file(fname, out, binary=False)
def convert_list_to_dict(adjust_cfg_list):
"""Convert a list of config changes into the dict used by adjust_cfg_file()
@@ -219,7 +219,7 @@ def check_cfg_file(fname, adjust_cfg):
Returns:
str: None if OK, else an error string listing the problems
"""
- lines = tools.ReadFile(fname, binary=False).splitlines()
+ lines = tools.read_file(fname, binary=False).splitlines()
bad_cfgs = check_cfg_lines(lines, adjust_cfg)
if bad_cfgs:
out = [f'{cfg:20} {line}' for cfg, line in bad_cfgs]
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 6fcceb0..fbf6706 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -524,12 +524,6 @@ class TestFunctional(unittest.TestCase):
# Each commit has a config and make
self.assertEqual(self._make_calls, len(boards) * self._commits * 2)
- def testForceReconfigure(self):
- """The -f flag should force a rebuild"""
- self._RunControl('-b', TEST_BRANCH, '-C', '-o', self._output_dir)
- # Each commit has a config and make
- self.assertEqual(self._make_calls, len(boards) * self._commits * 2)
-
def testMrproper(self):
"""The -f flag should force a rebuild"""
self._RunControl('-b', TEST_BRANCH, '-m', '-o', self._output_dir)
diff --git a/tools/buildman/kconfiglib.py b/tools/buildman/kconfiglib.py
index c67895c..b9f3756 100644
--- a/tools/buildman/kconfiglib.py
+++ b/tools/buildman/kconfiglib.py
@@ -556,6 +556,7 @@ from os.path import dirname, exists, expandvars, islink, join, realpath
VERSION = (14, 1, 0)
+# pylint: disable=E1101
# File layout:
#
diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index 0127106..3b6af24 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -30,8 +30,8 @@ from patman import terminal
from patman import test_util
def RunTests(skip_net_tests, verboose, args):
- import func_test
- import test
+ from buildman import func_test
+ from buildman import test
import doctest
result = unittest.TestResult()
diff --git a/tools/concurrencytest/__init__.py b/tools/concurrencytest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/concurrencytest/__init__.py
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index ea88954..c81bcc9 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -16,13 +16,13 @@ import os
import struct
import unittest
-from dtb_platdata import Ftype
-from dtb_platdata import get_value
-from dtb_platdata import tab_to
from dtoc import dtb_platdata
from dtoc import fdt
from dtoc import fdt_util
from dtoc import src_scan
+from dtoc.dtb_platdata import Ftype
+from dtoc.dtb_platdata import get_value
+from dtoc.dtb_platdata import tab_to
from dtoc.src_scan import conv_name_to_c
from dtoc.src_scan import get_compat_name
from patman import test_util
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 576d65b..28231e5 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -25,7 +25,7 @@ sys.path.insert(2, os.path.join(our_path,
from dtoc import fdt
from dtoc import fdt_util
from dtoc.fdt_util import fdt32_to_cpu, fdt64_to_cpu
-from fdt import Type, BytesToValue
+from dtoc.fdt import Type, BytesToValue
import libfdt
from patman import command
from patman import test_util
@@ -119,9 +119,9 @@ class TestFdt(unittest.TestCase):
"""Test that packing a device tree works"""
self.dtb.Pack()
- def testGetFdt(self):
+ def testGetFdtRaw(self):
"""Tetst that we can access the raw device-tree data"""
- self.assertTrue(isinstance(self.dtb.GetContents(), bytearray))
+ self.assertTrue(isinstance(self.dtb.GetContents(), bytes))
def testGetProps(self):
"""Tests obtaining a list of properties"""
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index cff1e30..d4a96ef 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -339,7 +339,7 @@ def read_file(fname, as_lines=True, skip_unicode=False):
return inf.read()
except UnicodeDecodeError as e:
if not skip_unicode:
- raises
+ raise
print("Failed on file %s': %s" % (fname, e))
return None
@@ -790,9 +790,6 @@ class KconfigParser:
actlog = "'%s' is the same as the define in Kconfig. Do nothing." \
% value
log_color = COLOR_LIGHT_PURPLE
- elif action == ACTION_SPL_NOT_EXIST:
- actlog = 'SPL is not enabled for this defconfig. Skip.'
- log_color = COLOR_PURPLE
else:
sys.exit('Internal Error. This should not happen.')
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index dd792ef..70ba561 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -125,7 +125,7 @@ def check_patch_parse(checkpatch_output, verbose=False):
Returns:
namedtuple containing:
ok: False=failure, True=ok
- problems: List of problems, each a dict:
+ problems (list of problems): each a dict:
'type'; error or warning
'msg': text message
'file' : filename
@@ -252,6 +252,8 @@ def check_patches(verbose, args):
if (len(result.problems) != result.errors + result.warnings +
result.checks):
print("Internal error: some problems lost")
+ # Python seems to get confused by this
+ # pylint: disable=E1133
for item in result.problems:
sys.stderr.write(
get_warning_msg(col, item.get('type', '<unknown>'),
diff --git a/tools/patman/command.py b/tools/patman/command.py
index 2435878..92c453b 100644
--- a/tools/patman/command.py
+++ b/tools/patman/command.py
@@ -17,13 +17,6 @@ class CommandResult:
return_code: Return code from command
exception: Exception received, or None if all ok
"""
- def __init__(self):
- self.stdout = None
- self.stderr = None
- self.combined = None
- self.return_code = None
- self.exception = None
-
def __init__(self, stdout='', stderr='', combined='', return_code=0,
exception=None):
self.stdout = stdout
@@ -72,6 +65,7 @@ def run_pipe(pipe_list, infile=None, outfile=None,
"""
if test_result:
if hasattr(test_result, '__call__'):
+ # pylint: disable=E1102
result = test_result(pipe_list=pipe_list)
if result:
return result
diff --git a/tools/patman/commit.py b/tools/patman/commit.py
index c331a3b..a645b22 100644
--- a/tools/patman/commit.py
+++ b/tools/patman/commit.py
@@ -31,7 +31,7 @@ class Commit:
"""
def __init__(self, hash):
self.hash = hash
- self.subject = None
+ self.subject = ''
self.tags = []
self.changes = {}
self.cc_list = []
diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
index f1b2608..cd614f3 100644
--- a/tools/patman/cros_subprocess.py
+++ b/tools/patman/cros_subprocess.py
@@ -113,7 +113,7 @@ class Popen(subprocess.Popen):
return b''
return data
- def communicate_filter(self, output):
+ def communicate_filter(self, output, input_buf=''):
"""Interact with process: Read data from stdout and stderr.
This method runs until end-of-file is reached, then waits for the
@@ -166,7 +166,7 @@ class Popen(subprocess.Popen):
# Flush stdio buffer. This might block, if the user has
# been writing to .stdin in an uncontrolled fashion.
self.stdin.flush()
- if input:
+ if input_buf:
write_set.append(self.stdin)
else:
self.stdin.close()
@@ -195,10 +195,10 @@ class Popen(subprocess.Popen):
# When select has indicated that the file is writable,
# we can write up to PIPE_BUF bytes without risk
# blocking. POSIX defines PIPE_BUF >= 512
- chunk = input[input_offset : input_offset + 512]
+ chunk = input_buf[input_offset : input_offset + 512]
bytes_written = os.write(self.stdin.fileno(), chunk)
input_offset += bytes_written
- if input_offset >= len(input):
+ if input_offset >= len(input_buf):
self.stdin.close()
write_set.remove(self.stdin)
@@ -240,16 +240,6 @@ class Popen(subprocess.Popen):
stderr = self.convert_data(stderr)
combined = self.convert_data(combined)
- # Translate newlines, if requested. We cannot let the file
- # object do the translation: It is based on stdio, which is
- # impossible to combine with select (unless forcing no
- # buffering).
- if self.universal_newlines and hasattr(file, 'newlines'):
- if stdout:
- stdout = self._translate_newlines(stdout)
- if stderr:
- stderr = self._translate_newlines(stderr)
-
self.wait()
return (stdout, stderr, combined)
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 59ee90c..7b92bc6 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -341,6 +341,8 @@ Changes in v2:
tools.write_file(path, text, binary=False)
index = self.repo.index
index.add(fname)
+ # pylint doesn't seem to find this
+ # pylint: disable=E1101
author = pygit2.Signature('Test user', 'test@email.com')
committer = author
tree = index.write_tree()
@@ -363,6 +365,8 @@ Changes in v2:
self.repo = repo
new_tree = repo.TreeBuilder().write()
+ # pylint doesn't seem to find this
+ # pylint: disable=E1101
author = pygit2.Signature('Test user', 'test@email.com')
committer = author
_ = repo.create_commit('HEAD', author, committer, 'Created master',
@@ -414,6 +418,8 @@ better than before''')
first_target = repo.revparse_single('HEAD')
target = repo.revparse_single('HEAD~2')
+ # pylint doesn't seem to find this
+ # pylint: disable=E1101
repo.reset(target.oid, pygit2.GIT_CHECKOUT_FORCE)
self.make_commit_with_file('video: Some video improvements', '''
Fix up the video so that
@@ -459,6 +465,8 @@ complicated as possible''')
"""Test creating patches from a branch"""
repo = self.make_git_tree()
target = repo.lookup_reference('refs/heads/first')
+ # pylint doesn't seem to find this
+ # pylint: disable=E1101
self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE)
control.setup()
try:
@@ -615,6 +623,8 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
"""Test CountCommitsToBranch when there is no upstream"""
repo = self.make_git_tree()
target = repo.lookup_reference('refs/heads/base')
+ # pylint doesn't seem to find this
+ # pylint: disable=E1101
self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE)
# Check that it can detect the current branch
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 9b32fd4..fb6a603 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -597,7 +597,7 @@ class PatchStream:
if 'prefix' in self.series:
parts.append(self.series['prefix'])
if 'postfix' in self.series:
- parts.append(self.serties['postfix'])
+ parts.append(self.series['postfix'])
if 'version' in self.series:
parts.append("v%s" % self.series['version'])
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 891f278..3075378 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -122,8 +122,7 @@ class Series(dict):
cc_list = list(self._generated_cc[commit.patch])
for email in sorted(set(cc_list) - to_set - cc_set):
if email == None:
- email = col.build(col.YELLOW, "<alias '%s' not found>"
- % tag)
+ email = col.build(col.YELLOW, '<alias not found>')
if email:
print(' Cc: ', email)
print
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 014bb37..7c2b5c1 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -200,12 +200,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
"""
name = gitutil.get_default_user_name()
if name == None:
- name = raw_input("Enter name: ")
+ name = input("Enter name: ")
email = gitutil.get_default_user_email()
if email == None:
- email = raw_input("Enter email: ")
+ email = input("Enter email: ")
try:
f = open(config_fname, 'w')
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 5e4d4ac..2ac814d 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -62,8 +62,8 @@ def prepare_output_dir(dirname, preserve=False):
try:
os.makedirs(outdir)
except OSError as err:
- raise CmdError("Cannot make output directory '%s': '%s'" %
- (outdir, err.strerror))
+ raise ValueError(
+ f"Cannot make output directory 'outdir': 'err.strerror'")
tout.debug("Using output directory '%s'" % outdir)
else:
outdir = tempfile.mkdtemp(prefix='binman.')
@@ -160,7 +160,7 @@ def get_input_filename_glob(pattern):
A list of matching files in all input directories
"""
if not indir:
- return glob.glob(fname)
+ return glob.glob(pattern)
files = []
for dirname in indir:
pathname = os.path.join(dirname, pattern)
@@ -201,7 +201,7 @@ def path_has_file(path_spec, fname):
return True
return False
-def get_host_compile_tool(name):
+def get_host_compile_tool(env, name):
"""Get the host-specific version for a compile tool
This checks the environment variables that specify which version of
@@ -356,7 +356,7 @@ def run_result(name, *args, **kwargs):
name, extra_args = get_target_compile_tool(name)
args = tuple(extra_args) + args
elif for_host:
- name, extra_args = get_host_compile_tool(name)
+ name, extra_args = get_host_compile_tool(env, name)
args = tuple(extra_args) + args
name = os.path.expanduser(name) # Expand paths containing ~
all_args = (name,) + args