Continue FreeCAD Web UI parity repairs
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
CodeQL Advanced (c-cpp) / Analyze (c-cpp) (push) Has been cancelled
Push Crowdin Translations / update-crowdin (push) Has been cancelled
Fetch Crowdin Translations / update-crowdin (push) Has been cancelled
Build Release / upload_src (push) Has been cancelled
Build Release / build (10.13, macos-15-intel, osx-64) (push) Has been cancelled
Build Release / build (11.0, macos-latest, osx-arm64) (push) Has been cancelled
Build Release / build (15.0, macos-latest, osx-arm64) (push) Has been cancelled
Build Release / build (ubuntu-22.04, linux-64) (push) Has been cancelled
Build Release / build (ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Build Release / build (windows-latest, win-64) (push) Has been cancelled
Monthly issue metrics / issue metrics (push) Has been cancelled

This commit is contained in:
2026-09-23 14:03:56 +08:00
parent 2121db4358
commit 789e18ca3e
27 changed files with 48881 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""Build the configured operator frontend from its fixed working directory.
No npm lifecycle hooks, standalone typechecks, tests or native builds. The
caller groups related frontend edits before invoking this delivery command.
"""
import os
import fcntl
from pathlib import Path
import shutil
import subprocess
import sys
import time
def main():
web = Path(__file__).resolve().parents[1] / "web"
vite = web / "node_modules/vite/bin/vite.js"
node = shutil.which("node")
if not node or not vite.is_file():
print(f"Frontend dependency unavailable: node={node}, Vite={vite}", file=sys.stderr)
return 2
env = {**os.environ, "FREECAD_WEB_FAST_LINK": "ON"}
# The foreground session and the sole scheduler share web/dist. Keep the
# lock outside dist: Vite clears that directory before writing a bundle.
with (web / ".freecad-web-frontend-build.lock").open("a") as lock:
started = time.monotonic()
waiting = False
while True:
try:
fcntl.flock(lock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
break
except BlockingIOError:
if not waiting:
print("Waiting for the existing frontend delivery to release web/dist", flush=True)
waiting = True
if time.monotonic() - started >= 1800:
print("Frontend delivery lock timed out; retain edits and resume after the active build", file=sys.stderr)
return 124
time.sleep(0.25)
# Vite retains the descriptor if the outer runner exits mid-delivery.
return subprocess.run([node, str(vite), "build"], cwd=web, env=env,
pass_fds=(lock.fileno(),), check=False).returncode
if __name__ == "__main__":
raise SystemExit(main())