[PATCH 02/24] qconfig: Drop the try_expand() function

Simon Glass sjg at chromium.org
Wed Jul 17 17:56:50 CEST 2024


This is not used anymore, so drop it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/qconfig.py | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/tools/qconfig.py b/tools/qconfig.py
index 2492b37444a..7d3989c7c3e 100755
--- a/tools/qconfig.py
+++ b/tools/qconfig.py
@@ -29,7 +29,6 @@ import threading
 import time
 import unittest
 
-import asteval
 from buildman import bsettings
 from buildman import kconfiglib
 from buildman import toolchain
@@ -216,26 +215,6 @@ def read_file(fname, as_lines=True, skip_unicode=False):
             print(f"Failed on file '{fname}: {exc}")
             return None
 
-def try_expand(line):
-    """If value looks like an expression, try expanding it
-    Otherwise just return the existing value
-    """
-    if line.find('=') == -1:
-        return line
-
-    try:
-        aeval = asteval.Interpreter( usersyms=SIZES, minimal=True )
-        cfg, val = re.split("=", line)
-        val= val.strip('\"')
-        if re.search(r'[*+-/]|<<|SZ_+|\(([^\)]+)\)', val):
-            newval = hex(aeval(val))
-            print(f'\tExpanded expression {val} to {newval}')
-            return cfg+'='+newval
-    except:
-        print(f'\tFailed to expand expression in {line}')
-
-    return line
-
 
 ### classes ###
 class Progress:
-- 
2.34.1



More information about the U-Boot mailing list