Files

17 lines
840 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Chromium для браузерных приемок Эвномии. Кеша браузеров Playwright на машине может не быть
(03.10.2026 его нет вовсе: helioz-browser.mjs), поэтому берется любой Chromium с диска."""
from __future__ import annotations
import glob
import os
from pathlib import Path
CHROMES = [os.environ.get('EUNOMIA_CHROME', ''),
*sorted(glob.glob(str(Path.home() / '.cache/puppeteer/chrome-headless-shell/*/*/chrome-headless-shell')), reverse=True),
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome']
def executable() -> str | None:
"""Путь к Chromium с диска; None - Playwright возьмет свой из кеша."""
return next((path for path in CHROMES if path and Path(path).is_file()), None)