migrate stock user space build to new build system
[lunaix-os.git] / lunaix-os / scripts / build-tools / lcfg2 / builder.py
index 40fabfb0d74e48e4fa3d6b4172ba452936fbc721..832807afbe12f62381ea0f8ede2288d879dfa834 100644 (file)
@@ -1,5 +1,6 @@
 import ast
 import textwrap
+import os
 
 from lib.utils  import ConfigAST, ConfigASTVisitor
 from .common     import NodeProperty, ConfigNodeError, ValueTypeConstrain
@@ -99,6 +100,10 @@ class NodeBuilder(ConfigASTVisitor):
 
     @staticmethod
     def build(env, rootfile):
+        if not os.path.exists(rootfile):
+            print(f"warning: config file '{rootfile}' not detected, skipped")
+            return
+
         build = NodeBuilder(env)
         ast = ConfigAST(rootfile)
         
@@ -106,5 +111,8 @@ class NodeBuilder(ConfigASTVisitor):
         ast.visit(TreeSanitiser())
         ast.visit(build)
 
+        for node in env.nodes():
+            node.apply_node_body()
+
         env.set_exec_context(build.__noncfg_astns)
         env.relocate_children()
\ No newline at end of file