feat: refresh model and voice test catalog with favicon
This commit is contained in:
+24
-1
@@ -70,13 +70,36 @@ class SecretFilter:
|
||||
return result
|
||||
|
||||
|
||||
def read_secret_tables(tables):
|
||||
values = []
|
||||
for table in tables:
|
||||
path = Path(table["path"])
|
||||
column = table.get("key_column", 1)
|
||||
if type(column) is not int or not 0 <= column <= 8 or path.stat().st_size > 262144:
|
||||
raise ValueError("原认证表格式或大小不支持")
|
||||
found = False
|
||||
for line in path.read_text(encoding="utf-8").splitlines():
|
||||
if not line.strip() or line.lstrip().startswith("#"):
|
||||
continue
|
||||
fields = line.split()
|
||||
if table.get("label") and fields[0] != table["label"]:
|
||||
continue
|
||||
if len(fields) <= column:
|
||||
raise ValueError("原认证表缺少登记列")
|
||||
values.append(fields[column])
|
||||
found = True
|
||||
if not found:
|
||||
raise ValueError("原认证表缺少登记的测试身份")
|
||||
return values
|
||||
|
||||
|
||||
def load_environment(plan):
|
||||
import pwd
|
||||
account = pwd.getpwnam(plan["user"])
|
||||
env = {"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "HOME": account.pw_dir,
|
||||
"USER": account.pw_name, "LOGNAME": account.pw_name, "LANG": "C.UTF-8", "TERM": "xterm",
|
||||
"PYTHONUNBUFFERED": "1", "PYTHONDONTWRITEBYTECODE": "1"}
|
||||
secrets = []
|
||||
secrets = read_secret_tables(plan.get("secret_tables", []))
|
||||
for path in plan.get("env_setup_files", []):
|
||||
# Only server-owned recipe paths reach this command; output stays in private process memory.
|
||||
command = ["/bin/bash", "-c", 'set -a; source "$1" >/dev/null; /usr/bin/env -0', "xas-env", path]
|
||||
|
||||
Reference in New Issue
Block a user