Skip to content

Commit 2c5170d

Browse files
committed
Change dependency parsing
1 parent 5d73944 commit 2c5170d

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

build_platform.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,29 @@ def group_output(title):
341341

342342
def extract_dependencies(output):
343343
print("Extracting libraries from output:", output)
344-
print(f"{"# Done #":-^80}")
345-
library_pattern = re.compile(r'^\s*([\w\s-]+)\s+([\d\.]+(?:-[\w\.]+)?)\s+(.+)$')
346-
platform_pattern = re.compile(r'^Used platform\s+([\w:]+)\s+([\d\.]+)\s+(.+)$')
347-
348-
libraries = library_pattern.findall(output)
349-
platforms = platform_pattern.findall(output)
344+
print(f"{"############## Done #############":-^80}")
345+
346+
IS_LIBS_FOUND = False
347+
IS_BSP_FOUND = False
348+
libraries = []
349+
platforms = []
350+
COLS = []
351+
for line in output.split('\n'):
352+
if not IS_LIBS_FOUND:
353+
if re.match(r'^Used library', line):
354+
IS_LIBS_FOUND = True
355+
COLS = [0,str.find(line, 'Version'), str.find(line, 'Path')]
356+
break
357+
else:
358+
if not IS_BSP_FOUND:
359+
if re.match(r'^Used platform', line):
360+
IS_BSP_FOUND = True
361+
COLS = [0,str.find(line, 'Version'), str.find(line, 'Path')]
362+
break
363+
else:
364+
libraries.append((line[:COLS[1]].strip(),line[COLS[1]:COLS[2]].strip()))
365+
else:
366+
platforms.append((line[:COLS[1]].strip(),line[COLS[1]:COLS[2]].strip()))
350367

351368
dependencies = {
352369
'libraries': libraries,

0 commit comments

Comments
 (0)