From: Roland Dobai Date: Fri, 26 Apr 2019 10:50:20 +0000 (+0200) Subject: Confgen: Fix prefix removal to work for exact match only X-Git-Tag: v4.0-beta1~317^2~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30ca5c7a88f0e220ec0acce83ac20581c4514164;p=esp-idf Confgen: Fix prefix removal to work for exact match only --- diff --git a/tools/kconfig_new/confgen.py b/tools/kconfig_new/confgen.py index 5d49c85392..68c453a868 100755 --- a/tools/kconfig_new/confgen.py +++ b/tools/kconfig_new/confgen.py @@ -58,6 +58,12 @@ class DeprecatedOptions(object): rep_dic = {} rev_rep_dic = {} + def remove_config_prefix(string): + if string.startswith(self.config_prefix): + return string[len(self.config_prefix):] + raise RuntimeError('Error in {} (line {}): Config {} is not prefixed with {}' + ''.format(rep_path, line_number, string, self.config_prefix)) + for root, dirnames, filenames in os.walk(repl_dir): for filename in fnmatch.filter(filenames, self._REN_FILE): rep_path = os.path.join(root, filename) @@ -75,7 +81,8 @@ class DeprecatedOptions(object): 'replacement {} is defined'.format(rep_path, line_number, rep_dic[sp_line[0]], sp_line[0], sp_line[1])) - (dep_opt, new_opt) = (x.lstrip(self.config_prefix) for x in sp_line) + + (dep_opt, new_opt) = (remove_config_prefix(x) for x in sp_line) rep_dic[dep_opt] = new_opt rev_rep_dic[new_opt] = dep_opt return rep_dic, rev_rep_dic