]> granicus.if.org Git - esp-idf/commitdiff
tools: Ignore sdkconfig.rename files from the example directory
authorRoland Dobai <dobai.roland@gmail.com>
Thu, 9 May 2019 14:14:42 +0000 (16:14 +0200)
committerRoland Dobai <dobai.roland@gmail.com>
Tue, 21 May 2019 07:09:01 +0000 (09:09 +0200)
tools/kconfig_new/confgen.py

index 7531b7f210657299c7d804ad4af166f507a25f12..04dca5d4c1050d119c762f825ecc67e0767087ea 100755 (executable)
@@ -46,15 +46,15 @@ class DeprecatedOptions(object):
     _RE_DEP_OP_BEGIN = re.compile(_DEP_OP_BEGIN)
     _RE_DEP_OP_END = re.compile(_DEP_OP_END)
 
-    def __init__(self, config_prefix, path_rename_files):
+    def __init__(self, config_prefix, path_rename_files, ignore_dirs=()):
         self.config_prefix = config_prefix
         # r_dic maps deprecated options to new options; rev_r_dic maps in the opposite direction
-        self.r_dic, self.rev_r_dic = self._parse_replacements(path_rename_files)
+        self.r_dic, self.rev_r_dic = self._parse_replacements(path_rename_files, ignore_dirs)
 
         # note the '=' at the end of regex for not getting partial match of configs
         self._RE_CONFIG = re.compile(r'{}(\w+)='.format(self.config_prefix))
 
-    def _parse_replacements(self, repl_dir):
+    def _parse_replacements(self, repl_dir, ignore_dirs):
         rep_dic = {}
         rev_rep_dic = {}
 
@@ -68,6 +68,10 @@ class DeprecatedOptions(object):
             for filename in fnmatch.filter(filenames, self._REN_FILE):
                 rep_path = os.path.join(root, filename)
 
+                if rep_path.startswith(ignore_dirs):
+                    print('Ignoring: {}'.format(rep_path))
+                    continue
+
                 with open(rep_path) as f_rep:
                     for line_number, line in enumerate(f_rep, start=1):
                         sp_line = line.split()
@@ -222,7 +226,10 @@ def main():
                 raise RuntimeError("Defaults file not found: %s" % name)
             config.load_config(name, replace=False)
 
-    deprecated_options = DeprecatedOptions(config.config_prefix, path_rename_files=os.environ["IDF_PATH"])
+    # don't collect rename options from examples because those are separate projects and no need to "stay compatible"
+    # with example projects
+    deprecated_options = DeprecatedOptions(config.config_prefix, path_rename_files=os.environ["IDF_PATH"],
+                                           ignore_dirs=(os.path.join(os.environ["IDF_PATH"], 'examples')))
 
     # If config file previously exists, load it
     if args.config and os.path.exists(args.config):