Преглед изворни кода

cmake: convert_to_cmake: Fix possible whitespace issues

As reported on forum:
https://esp32.com/viewtopic.php?f=2&t=13565&p=53476#p53453

split() with no arg will match any whitespace sequence not just
a single space, so takes care of case where two spaces are
inserted in the variable value.
Angus Gratton пре 6 година
родитељ
комит
ee8557f69d
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      tools/cmake/convert_to_cmake.py

+ 3 - 3
tools/cmake/convert_to_cmake.py

@@ -78,14 +78,14 @@ def get_component_variables(project_path, component_path):
             return None
 
         srcs = []
-        for obj in make_vars["COMPONENT_OBJS"].split(" "):
+        for obj in make_vars["COMPONENT_OBJS"].split():
             src = find_src(obj)
             if src is not None:
                 srcs.append(src)
         make_vars["COMPONENT_SRCS"] = " ".join(srcs)
     else:
         component_srcs = list()
-        for component_srcdir in make_vars.get("COMPONENT_SRCDIRS", ".").split(" "):
+        for component_srcdir in make_vars.get("COMPONENT_SRCDIRS", ".").split():
             component_srcdir_path = os.path.abspath(os.path.join(component_path, component_srcdir))
 
             srcs = list()
@@ -114,7 +114,7 @@ def convert_project(project_path):
     if "PROJECT_NAME" not in project_vars:
         raise RuntimeError("PROJECT_NAME does not appear to be defined in IDF project Makefile at %s" % project_path)
 
-    component_paths = project_vars["COMPONENT_PATHS"].split(" ")
+    component_paths = project_vars["COMPONENT_PATHS"].split()
 
     # Convert components as needed
     for p in component_paths: