Fixed missing types.
This commit is contained in:
parent
0d4a17fb26
commit
745918c003
6 changed files with 15 additions and 15 deletions
|
@ -210,7 +210,7 @@ def instanciateDisabled(component: ComponentManifest, target: TargetManifest) -
|
||||||
return ComponentInstance(False, component.isEnabled(target)[1], component, [], [])
|
return ComponentInstance(False, component.isEnabled(target)[1], component, [], [])
|
||||||
|
|
||||||
|
|
||||||
context: dict = {}
|
context: dict[str, Context] = {}
|
||||||
|
|
||||||
|
|
||||||
def contextFor(targetSpec: str, props: Props = {}) -> Context:
|
def contextFor(targetSpec: str, props: Props = {}) -> Context:
|
||||||
|
|
|
@ -43,8 +43,8 @@ def makeMixinOptimize(level: str) -> Mixin:
|
||||||
|
|
||||||
|
|
||||||
def mixinDebug(target: TargetManifest, tools: Tools) -> Tools:
|
def mixinDebug(target: TargetManifest, tools: Tools) -> Tools:
|
||||||
patchToolArgs(tools, "cc", ["-g"])
|
patchToolArgs(tools, "cc", ["-g", "-gdwarf-4"])
|
||||||
patchToolArgs(tools, "cxx", ["-g"])
|
patchToolArgs(tools, "cxx", ["-g", "-gdwarf-4"])
|
||||||
|
|
||||||
return tools
|
return tools
|
||||||
|
|
||||||
|
@ -66,5 +66,6 @@ mixins: dict[str, Mixin] = {
|
||||||
def append(mixinSpec: str, mixin: Mixin):
|
def append(mixinSpec: str, mixin: Mixin):
|
||||||
mixins[mixinSpec] = mixin
|
mixins[mixinSpec] = mixin
|
||||||
|
|
||||||
|
|
||||||
def byId(id: str) -> Mixin:
|
def byId(id: str) -> Mixin:
|
||||||
return mixins[id]
|
return mixins[id]
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import os
|
import os
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from json import JSONEncoder
|
|
||||||
|
|
||||||
from osdk.jexpr import Json
|
from osdk.jexpr import Json
|
||||||
from osdk.logger import Logger
|
from osdk.logger import Logger
|
||||||
from osdk import const, utils
|
|
||||||
|
|
||||||
|
|
||||||
logger = Logger("model")
|
logger = Logger("model")
|
||||||
|
@ -26,7 +24,7 @@ class Manifest:
|
||||||
type: Type = Type.UNKNOWN
|
type: Type = Type.UNKNOWN
|
||||||
path: str = ""
|
path: str = ""
|
||||||
|
|
||||||
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
|
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
|
||||||
if json is not None:
|
if json is not None:
|
||||||
if not "id" in json:
|
if not "id" in json:
|
||||||
raise ValueError("Missing id")
|
raise ValueError("Missing id")
|
||||||
|
@ -59,7 +57,7 @@ class Extern:
|
||||||
git: str = ""
|
git: str = ""
|
||||||
tag: str = ""
|
tag: str = ""
|
||||||
|
|
||||||
def __init__(self, json: Json = None, strict=True, **kwargs):
|
def __init__(self, json: Json = None, strict: bool = True, **kwargs: Any):
|
||||||
if json is not None:
|
if json is not None:
|
||||||
if not "git" in json and strict:
|
if not "git" in json and strict:
|
||||||
raise ValueError("Missing git")
|
raise ValueError("Missing git")
|
||||||
|
@ -87,7 +85,7 @@ class ProjectManifest(Manifest):
|
||||||
description: str = ""
|
description: str = ""
|
||||||
extern: dict[str, Extern] = {}
|
extern: dict[str, Extern] = {}
|
||||||
|
|
||||||
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
|
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
|
||||||
if json is not None:
|
if json is not None:
|
||||||
if not "description" in json and strict:
|
if not "description" in json and strict:
|
||||||
raise ValueError("Missing description")
|
raise ValueError("Missing description")
|
||||||
|
@ -113,7 +111,7 @@ class Tool:
|
||||||
args: list[str] = []
|
args: list[str] = []
|
||||||
files: list[str] = []
|
files: list[str] = []
|
||||||
|
|
||||||
def __init__(self, json: Json = None, strict=True, **kwargs):
|
def __init__(self, json: Json = None, strict: bool = True, **kwargs: Any):
|
||||||
if json is not None:
|
if json is not None:
|
||||||
if not "cmd" in json and strict:
|
if not "cmd" in json and strict:
|
||||||
raise ValueError("Missing cmd")
|
raise ValueError("Missing cmd")
|
||||||
|
@ -147,7 +145,7 @@ class TargetManifest(Manifest):
|
||||||
tools: Tools
|
tools: Tools
|
||||||
routing: dict[str, str]
|
routing: dict[str, str]
|
||||||
|
|
||||||
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
|
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
|
||||||
if json is not None:
|
if json is not None:
|
||||||
if not "props" in json and strict:
|
if not "props" in json and strict:
|
||||||
raise ValueError("Missing props")
|
raise ValueError("Missing props")
|
||||||
|
@ -194,7 +192,7 @@ class ComponentManifest(Manifest):
|
||||||
provides: list[str] = []
|
provides: list[str] = []
|
||||||
subdirs: list[str] = []
|
subdirs: list[str] = []
|
||||||
|
|
||||||
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
|
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
|
||||||
if json is not None:
|
if json is not None:
|
||||||
self.decription = json.get("description", self.decription)
|
self.decription = json.get("description", self.decription)
|
||||||
self.props = json.get("props", self.props)
|
self.props = json.get("props", self.props)
|
||||||
|
|
|
@ -33,6 +33,8 @@ def uname() -> Uname:
|
||||||
result.machine = "arm64"
|
result.machine = "arm64"
|
||||||
case "AMD64":
|
case "AMD64":
|
||||||
result.machine = "x86_64"
|
result.machine = "x86_64"
|
||||||
|
case _:
|
||||||
|
pass
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -102,7 +104,8 @@ def wget(url: str, path: str | None = None) -> str:
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
if path is None:
|
if path is None:
|
||||||
path = os.path.join(const.CACHE_DIR,
|
path = os.path.join(
|
||||||
|
const.CACHE_DIR,
|
||||||
hashlib.sha256(url.encode('utf-8')).hexdigest())
|
hashlib.sha256(url.encode('utf-8')).hexdigest())
|
||||||
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
|
|
|
@ -2,8 +2,6 @@ from typing import Any, TypeVar, cast
|
||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from osdk import shell, const
|
|
||||||
|
|
||||||
T = TypeVar('T')
|
T = TypeVar('T')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ def title(text: str):
|
||||||
print(f"{LIGHT_WHITE}{text}{RESET}:")
|
print(f"{LIGHT_WHITE}{text}{RESET}:")
|
||||||
|
|
||||||
|
|
||||||
def wordwrap(text: str, width: int = 60, newline="\n") -> str:
|
def wordwrap(text: str, width: int = 60, newline: str = "\n") -> str:
|
||||||
result = ""
|
result = ""
|
||||||
curr = 0
|
curr = 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue