File size: 757 Bytes
26fa2b2
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
"""Operator build bootstrap, never called with user-provided commands or URLs."""
import os,subprocess
from .settings import ROOT

def ensure_renderer():
    if not (ROOT/'frontend/dist/render.html').is_file():raise RuntimeError('Build the frontend before enabling IDOL.')
    if not (ROOT/'frontend/node_modules/playwright/package.json').is_file():
        subprocess.run(['npm','ci','--ignore-scripts','--prefix',str(ROOT/'frontend')],check=True,timeout=180)
    browser=os.getenv('CHROMIUM_EXECUTABLE','')
    if not browser or not os.path.isfile(browser):raise RuntimeError('Configure an installed Chromium before enabling IDOL.')
    if not os.path.isdir('/proc'):raise RuntimeError('The preview runtime must support process-group memory accounting.')