@@ -24,7 +24,7 @@ from os.path import normpath
24
24
25
25
# Check for miminum required lbuild version
26
26
import lbuild
27
- min_lbuild_version = "1.20 .0"
27
+ min_lbuild_version = "1.21 .0"
28
28
if StrictVersion (getattr (lbuild , "__version__" , "0.1.0" )) < StrictVersion (min_lbuild_version ):
29
29
print ("modm requires at least lbuild v{}, please upgrade!\n "
30
30
" pip3 install -U lbuild" .format (min_lbuild_version ))
@@ -224,15 +224,19 @@ def init(repo):
224
224
repo .add_ignore_patterns ("*/*.lb" , "*/board.xml" )
225
225
226
226
# Add the board configuration files as their module name aliases
227
- for config in Path (repopath ("src/modm/board" )).glob ("*/board.xml" ):
228
- name = re .search (r"<module>modm:board:(.*?)</module>" , config .read_text ()).group (1 )
229
- if (config .parent / "module.md" ).exists ():
230
- description = FileReader (str (config .parent / "module.md" ))
227
+ for module in Path (repopath ("src/modm/board" )).glob ("*/module.lb" ):
228
+ module_text = module .read_text ()
229
+ name = re .search (r"\.name += +\".*?:board:(.*?)\"" , module_text ).group (1 )
230
+ if (module .parent / "module.md" ).exists ():
231
+ description = FileReader (str (module .parent / "module.md" ))
231
232
else :
232
233
description = re .search (r'\.description += +(""".*?"""|".*?")' ,
233
- ( config . parent / "module.lb" ). read_text () , flags = re .S | re .M )
234
+ module_text , flags = re .S | re .M )
234
235
description = description .group (1 ).strip ('"\\ ' ) if description else None
235
- repo .add_configuration (name , config , description )
236
+ versions = re .search (r"#+ +[Rr]evisions? += +\[(.*)\]" , module_text )
237
+ versions = versions .group (1 ).split ("," ) if versions is not None else ["" ]
238
+ config = {v .strip (): (module .parent / "board.xml" ) for v in versions }
239
+ repo .add_configuration (Configuration (name , description , config , versions [0 ].strip ()))
236
240
237
241
# Backwards compatible move, remove this in 2022.
238
242
repo .add_alias (Alias (name = "blue-pill" , destination = ":blue-pill-f103" ,
0 commit comments