rewrite the lunabuild toolchain with enhanced feature
[lunaix-os.git] / lunaix-os / scripts / build-tools / shared / scopes.py
diff --git a/lunaix-os/scripts/build-tools/shared/scopes.py b/lunaix-os/scripts/build-tools/shared/scopes.py
new file mode 100644 (file)
index 0000000..a56c342
--- /dev/null
@@ -0,0 +1,14 @@
+from lbuild.scope import ScopeProvider
+from lcfg2.common import NodeProperty
+
+class ConfigScope(ScopeProvider):
+    def __init__(self, env):
+        super().__init__("config")
+        self.__env = env
+
+    def __getitem__(self, name):
+        node = self.__env.get_node(name)
+        if node is None:
+            raise Exception(f"config '{name}' not exists")
+        
+        return NodeProperty.Value[node]
\ No newline at end of file