Skip to content

Commit 8b7623f

Browse files
author
PyCompiler ARK++
committed
feat(sysdeps): automate non-interactive installs with retries, timeouts, and detailed debug
feat(pyarmor): expand DEFAULT_SETTINGS (globbing, excludes, advanced flags, timeout, workspace opts) and wire to runtime chore(windows): winget auto-accept agreements for silent installs refactor(sysdeps): auto-resend sudo password prompts; broaden package manager detection (add yum)
1 parent 5572b8e commit 8b7623f

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

bcasl/bcasl_loader.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,12 @@ def run(self) -> None:
884884
order_list = list(self.cfg.get("plugin_order", [])) if isinstance(self.cfg, dict) else []
885885
except Exception:
886886
order_list = []
887+
if not order_list:
888+
try:
889+
meta_en = _discover_bcasl_meta(enabled_dir)
890+
order_list = list(_compute_tag_order(meta_en))
891+
except Exception:
892+
order_list = []
887893
# Priorité par 'plugin_order' en premier
888894
if order_list:
889895
for idx, pid in enumerate(order_list):
@@ -1135,6 +1141,53 @@ def _get_list(sym: str) -> list[str]:
11351141
return meta
11361142

11371143

1144+
def _compute_tag_order(meta_map: dict[str, dict[str, Any]]) -> list[str]:
1145+
"""Compute a default execution order based solely on BCASL_TAGS.
1146+
Returns a list of plugin ids (keys of meta_map) sorted by tag priority.
1147+
Lower score means earlier execution. Unknown/missing tags default to 100.
1148+
"""
1149+
try:
1150+
tag_score = {
1151+
# Clean early
1152+
"clean": 0, "cleanup": 0, "sanitize": 0, "prune": 0, "tidy": 0,
1153+
# Validation / security
1154+
"validation": 10, "presence": 10, "sanity": 10, "policy": 10, "requirements": 10,
1155+
"check": 10, "audit": 10, "scan": 10, "security": 10, "sast": 10, "compliance": 10, "license-check": 10,
1156+
# Tests
1157+
"test": 15, "tests": 15, "unit-test": 15, "integration-test": 15, "pytest": 15,
1158+
# Prepare / generate
1159+
"prepare": 20, "codegen": 20, "generate": 20, "fetch": 20, "resources": 20,
1160+
"download": 20, "install": 20, "bootstrap": 20, "configure": 20,
1161+
# Conformity / headers
1162+
"license": 30, "header": 30, "normalize": 30, "inject": 30, "spdx": 30, "banner": 30, "copyright": 30,
1163+
# Lint / format / typing
1164+
"lint": 40, "format": 40, "typecheck": 40, "mypy": 40, "flake8": 40, "ruff": 40, "pep8": 40, "black": 40, "isort": 40, "sort-imports": 40,
1165+
# Minification (before obfuscation)
1166+
"minify": 45, "uglify": 45, "shrink": 45, "compress-code": 45,
1167+
# Obfuscation / protect / transpile
1168+
"obfuscation": 50, "obfuscate": 50, "transpile": 50, "protect": 50, "encrypt": 50,
1169+
# Packaging / bundling
1170+
"package": 55, "packaging": 55, "bundle": 55, "archive": 55, "compress": 55, "zip": 55,
1171+
# Manifest / version / metadata
1172+
"manifest": 60, "version": 60, "metadata": 60, "bump": 60, "changelog": 60,
1173+
# Docs
1174+
"docs": 70, "documentation": 70, "doc": 70, "generate-docs": 70,
1175+
# Publish / deploy
1176+
"publish": 80, "deploy": 80, "release": 80,
1177+
}
1178+
def _score(pid: str) -> int:
1179+
try:
1180+
tags = meta_map.get(pid, {}).get("tags") or []
1181+
if isinstance(tags, list) and tags:
1182+
return int(min((tag_score.get(str(t).lower(), 100) for t in tags), default=100))
1183+
except Exception:
1184+
pass
1185+
return 100
1186+
return sorted(meta_map.keys(), key=lambda x: (_score(x), x))
1187+
except Exception:
1188+
return sorted(meta_map.keys())
1189+
1190+
11381191
def open_api_loader_dialog(self) -> None:
11391192
"""Ouvre une fenêtre permettant d'activer/désactiver les plugins API (BCASL).
11401193
- Source des plugins: <repo_root>/API (packages Python)
@@ -1205,6 +1258,11 @@ def open_api_loader_dialog(self) -> None:
12051258
order = [pid for pid in order if pid in plugin_ids]
12061259
except Exception:
12071260
order = []
1261+
if not order:
1262+
try:
1263+
order = [pid for pid in _compute_tag_order(meta_map) if pid in plugin_ids]
1264+
except Exception:
1265+
order = []
12081266
remaining = [pid for pid in plugin_ids if pid not in order]
12091267
ordered_ids = order + remaining
12101268
for pid in ordered_ids:
@@ -1904,6 +1962,12 @@ def _on_soft():
19041962
order_list = list(cfg.get("plugin_order", [])) if isinstance(cfg, dict) else []
19051963
except Exception:
19061964
order_list = []
1965+
if not order_list:
1966+
try:
1967+
meta_en = _discover_bcasl_meta(enabled_dir)
1968+
order_list = list(_compute_tag_order(meta_en))
1969+
except Exception:
1970+
order_list = []
19071971
if order_list:
19081972
for idx, pid in enumerate(order_list):
19091973
try:
@@ -2069,6 +2133,12 @@ def _on_finished(rep):
20692133
order_list = list(cfg.get("plugin_order", [])) if isinstance(cfg, dict) else []
20702134
except Exception:
20712135
order_list = []
2136+
if not order_list:
2137+
try:
2138+
meta_en = _discover_bcasl_meta(enabled_dir)
2139+
order_list = list(_compute_tag_order(meta_en))
2140+
except Exception:
2141+
order_list = []
20722142
if order_list:
20732143
for idx, pid in enumerate(order_list):
20742144
try:

0 commit comments

Comments
 (0)