moveconfig: Correct unused variables

Fix pylint warnings about unused variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-09-23 13:44:00 -06:00
parent 1bd43060b3
commit 62fae4bf66

View file

@ -620,7 +620,7 @@ class Slots:
self.slots = [] self.slots = []
devnull = subprocess.DEVNULL devnull = subprocess.DEVNULL
make_cmd = get_make_cmd() make_cmd = get_make_cmd()
for i in range(args.jobs): for _ in range(args.jobs):
self.slots.append(Slot(toolchains, args, progress, devnull, self.slots.append(Slot(toolchains, args, progress, devnull,
make_cmd, reference_src_dir, db_queue)) make_cmd, reference_src_dir, db_queue))
@ -772,7 +772,7 @@ def find_kconfig_rules(kconf, config, imply_config):
""" """
sym = kconf.syms.get(imply_config) sym = kconf.syms.get(imply_config)
if sym: if sym:
for sel, cond in (sym.selects + sym.implies): for sel, _ in (sym.selects + sym.implies):
if sel.name == config: if sel.name == config:
return sym return sym
return None return None
@ -941,7 +941,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added,
if add_imply and add_imply != 'all': if add_imply and add_imply != 'all':
add_imply = add_imply.split(',') add_imply = add_imply.split(',')
all_configs, all_defconfigs, config_db, defconfig_db = read_database() all_configs, all_defconfigs, _, defconfig_db = read_database()
# Work through each target config option in turn, independently # Work through each target config option in turn, independently
for config in config_list: for config in config_list:
@ -1101,7 +1101,7 @@ def do_find_config(config_list):
is preceded by a tilde (~) then it must be false, otherwise it must is preceded by a tilde (~) then it must be false, otherwise it must
be true) be true)
""" """
all_configs, all_defconfigs, config_db, defconfig_db = read_database() _, all_defconfigs, config_db, _ = read_database()
# Start with all defconfigs # Start with all defconfigs
out = all_defconfigs out = all_defconfigs
@ -1199,9 +1199,7 @@ def scan_makefiles(fnames):
fname_uses = {} fname_uses = {}
for fname, rest in fnames: for fname, rest in fnames:
m_iter = RE_MK_CONFIGS.finditer(rest) m_iter = RE_MK_CONFIGS.finditer(rest)
found = False
for m in m_iter: for m in m_iter:
found = True
real_opt = m.group(2) real_opt = m.group(2)
if real_opt == '': if real_opt == '':
continue continue
@ -1242,9 +1240,11 @@ def scan_src_files(fnames):
>>> RE_CONFIG_IS.search('#if CONFIG_IS_ENABLED(OF_PLATDATA)').groups() >>> RE_CONFIG_IS.search('#if CONFIG_IS_ENABLED(OF_PLATDATA)').groups()
('OF_PLATDATA',) ('OF_PLATDATA',)
""" """
fname = None
rest = None
def add_uses(m_iter, is_spl): def add_uses(m_iter, is_spl):
for m in m_iter: for m in m_iter:
found = True
real_opt = m.group(1) real_opt = m.group(1)
if real_opt == '': if real_opt == '':
continue continue
@ -1302,7 +1302,7 @@ def do_scan_source(path, do_update):
""" """
# Make sure we know about all the options # Make sure we know about all the options
not_found = collections.defaultdict(list) not_found = collections.defaultdict(list)
for use, rest in all_uses.items(): for use, _ in all_uses.items():
name = use.cfg name = use.cfg
if name in IGNORE_SYMS: if name in IGNORE_SYMS:
continue continue
@ -1314,7 +1314,6 @@ def do_scan_source(path, do_update):
# If it is an SPL symbol, try prepending all SPL_ prefixes to # If it is an SPL symbol, try prepending all SPL_ prefixes to
# find at least one SPL symbol # find at least one SPL symbol
if use.is_spl: if use.is_spl:
add_to_dict = False
for prefix in SPL_PREFIXES: for prefix in SPL_PREFIXES:
try_name = prefix + name try_name = prefix + name
sym = kconf.syms.get(try_name) sym = kconf.syms.get(try_name)
@ -1332,7 +1331,6 @@ def do_scan_source(path, do_update):
elif not use.is_spl: elif not use.is_spl:
check = False check = False
else: # MODE_NORMAL else: # MODE_NORMAL
debug = False
sym = kconf.syms.get(name) sym = kconf.syms.get(name)
if not sym: if not sym:
proper_name = is_not_proper(name) proper_name = is_not_proper(name)
@ -1373,7 +1371,7 @@ def do_scan_source(path, do_update):
print(f'Scanning source in {path}') print(f'Scanning source in {path}')
args = ['git', 'grep', '-E', r'IS_ENABLED|\bCONFIG'] args = ['git', 'grep', '-E', r'IS_ENABLED|\bCONFIG']
with subprocess.Popen(args, stdout=subprocess.PIPE) as proc: with subprocess.Popen(args, stdout=subprocess.PIPE) as proc:
out, err = proc.communicate() out, _ = proc.communicate()
lines = out.splitlines() lines = out.splitlines()
re_fname = re.compile('^([^:]*):(.*)') re_fname = re.compile('^([^:]*):(.*)')
src_list = [] src_list = []
@ -1407,7 +1405,7 @@ def do_scan_source(path, do_update):
print(f'Not sure how to handle file {fname}') print(f'Not sure how to handle file {fname}')
# Scan the Makefiles # Scan the Makefiles
all_uses, fname_uses = scan_makefiles(mk_list) all_uses, _ = scan_makefiles(mk_list)
spl_not_found = set() spl_not_found = set()
proper_not_found = set() proper_not_found = set()
@ -1428,7 +1426,7 @@ def do_scan_source(path, do_update):
proper_not_found |= set([key for key in not_found.keys()]) proper_not_found |= set([key for key in not_found.keys()])
# Scan the source code # Scan the source code
all_uses, fname_uses = scan_src_files(src_list) all_uses, _ = scan_src_files(src_list)
# Make sure we know about all the options # Make sure we know about all the options
print('\nCONFIG options present in source but not Kconfig:') print('\nCONFIG options present in source but not Kconfig:')
@ -1529,7 +1527,7 @@ doc/develop/moveconfig.rst for documentation.'''
if args.test: if args.test:
sys.argv = [sys.argv[0]] sys.argv = [sys.argv[0]]
fail, count = doctest.testmod() fail, _ = doctest.testmod()
if fail: if fail:
return 1 return 1
unittest.main() unittest.main()