aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2024-07-17 16:56:51 +0100
committerSimon Glass2024-07-26 08:01:06 -0600
commit0a0c124008500d5d66dd7ec752b0ab7206eef542 (patch)
treeddd0e429341bbb7374122af5d428611994180273
parentdeedf6530616a1af4c45058cb7367c98c8948c5b (diff)
qconfig: Make KconfigScanner a function
This doesn't have any methods so is not good as a class. Make it a function instead, to keep pylint happy. Signed-off-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-xtools/qconfig.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/qconfig.py b/tools/qconfig.py
index 7d3989c7c3e..a11ed5303d0 100755
--- a/tools/qconfig.py
+++ b/tools/qconfig.py
@@ -254,17 +254,18 @@ class Progress:
sys.stdout.flush()
-class KconfigScanner:
- """Kconfig scanner."""
+def scan_kconfig():
+ """Scan all the Kconfig files and create a Config object
- def __init__(self):
- """Scan all the Kconfig files and create a Config object."""
- # Define environment variables referenced from Kconfig
- os.environ['srctree'] = os.getcwd()
- os.environ['UBOOTVERSION'] = 'dummy'
- os.environ['KCONFIG_OBJDIR'] = ''
- os.environ['CC'] = 'gcc'
- self.conf = kconfiglib.Kconfig()
+ Returns:
+ Kconfig object
+ """
+ # Define environment variables referenced from Kconfig
+ os.environ['srctree'] = os.getcwd()
+ os.environ['UBOOTVERSION'] = 'dummy'
+ os.environ['KCONFIG_OBJDIR'] = ''
+ os.environ['CC'] = 'gcc'
+ return kconfiglib.Kconfig()
class KconfigParser:
@@ -912,7 +913,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added,
config - a CONFIG_XXX options (a string, e.g. 'CONFIG_CMD_EEPROM')
defconfig - a defconfig file (a string, e.g. 'configs/snow_defconfig')
"""
- kconf = KconfigScanner().conf if check_kconfig else None
+ kconf = scan_kconfig() if check_kconfig else None
if add_imply and add_imply != 'all':
add_imply = add_imply.split(',')
@@ -1342,7 +1343,7 @@ def do_scan_source(path, do_update):
print('Scanning Kconfig')
- kconf = KconfigScanner().conf
+ kconf = scan_kconfig()
print(f'Scanning source in {path}')
args = ['git', 'grep', '-E', r'IS_ENABLED|\bCONFIG']
with subprocess.Popen(args, stdout=subprocess.PIPE) as proc: