def create_proj(self):
yml = CommentedMap()
yml['project'] = CommentedMap()
#
def _add(name):
items = getattr(self, name)
#if BuildItem.trivial_item(items):
# yml['project'][name] = "_default_"
#elif BuildItem.no_flags_in_collection(items):
if BuildItem.no_flags_in_collection(items):
out = []
for s in items:
out.append(s.name)
yml['project'][name] = out
else:
out = []
for s in items:
cm = CommentedMap()
cm[s.name] = CommentedMap()
s.save_config(cm[s.name])
out.append(cm)
yml['project'][name] = out
#
_add('systems')
_add('architectures')
_add('compilers')
_add('build_types')
_add('variants')
txt = yaml.round_trip_dump(yml)
fn = self.kwargs['output_file']
if not os.path.isabs(fn):
fn = os.path.join(self.root_dir, fn)
with open(fn, "w") as f:
f.write(txt)
评论列表
文章目录