fix(chv): 完整 Chromium 检测认 CFT 布局 chrome-linux64
Playwright 1.64.1 下的 chrome-linux64.zip 解压为 chrome-linux64/ chrome,旧检查只认 chrome-linux/chrome:数据盘上 403M 完整版 已装好(含 DEPENDENCIES_VALIDATED)仍报未安装、mount_full 误 回落(2026-11-08 构建 #8 驱动实证)。两种布局都认;驱动安装 步在仍未装好时重试一次(客机慢出口 CDN 30 秒超时是抖动)。
This commit is contained in:
1 parent
9d986becaf
commit
0100ffe207
2 files changed
+21
-5
No files matched your search
@@ -138,22 +138,27 @@ def resolve_profile_dir(env=None, ismount=None):
|
|||||||
|
|
||||||
def full_chromium_executable(browsers_path=None):
|
def full_chromium_executable(browsers_path=None):
|
||||||
"""完整 Chromium 可执行文件路径(数据盘安装目录下),未装返回 None。
|
"""完整 Chromium 可执行文件路径(数据盘安装目录下),未装返回 None。
|
||||||
headless-shell 目录不算。"""
|
headless-shell 目录不算。布局有两种:经典 chrome-linux/chrome,
|
||||||
|
与 CFT(Playwright 1.64.1 下的 chrome-linux64.zip)chrome-linux64/
|
||||||
|
chrome——2026-11-08 构建 #8 驱动实证:装好的是后者,旧检查只认
|
||||||
|
前者而漏判,mount_full 误报未安装。"""
|
||||||
base = browsers_path or os.environ.get(
|
base = browsers_path or os.environ.get(
|
||||||
"PLAYWRIGHT_BROWSERS_PATH", PLAYWRIGHT_BROWSERS_PATH)
|
"PLAYWRIGHT_BROWSERS_PATH", PLAYWRIGHT_BROWSERS_PATH)
|
||||||
for cand in glob.glob(os.path.join(base, "chromium-*")):
|
for cand in glob.glob(os.path.join(base, "chromium-*")):
|
||||||
if os.path.basename(cand).startswith(
|
if os.path.basename(cand).startswith(
|
||||||
"chromium_headless_shell"):
|
"chromium_headless_shell"):
|
||||||
continue
|
continue
|
||||||
exe = os.path.join(cand, "chrome-linux", "chrome")
|
for sub in ("chrome-linux", "chrome-linux64"):
|
||||||
if os.path.isfile(exe):
|
exe = os.path.join(cand, sub, "chrome")
|
||||||
return exe
|
if os.path.isfile(exe):
|
||||||
|
return exe
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def full_chromium_present(browsers_path=None):
|
def full_chromium_present(browsers_path=None):
|
||||||
"""完整 Chromium 是否已装:ms-playwright 下有 chromium-*
|
"""完整 Chromium 是否已装:ms-playwright 下有 chromium-*
|
||||||
目录且含 chrome-linux/chrome(headless-shell 目录不算)。"""
|
目录且含 chrome-linux/chrome 或 chrome-linux64/chrome
|
||||||
|
(headless-shell 目录不算)。"""
|
||||||
return full_chromium_executable(browsers_path) is not None
|
return full_chromium_executable(browsers_path) is not None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -203,6 +203,17 @@ class FullBrowsersDirTest(unittest.TestCase):
|
|||||||
open(exe, "w").write("x")
|
open(exe, "w").write("x")
|
||||||
self.assertEqual(BROWSER.full_chromium_executable(tmp), exe)
|
self.assertEqual(BROWSER.full_chromium_executable(tmp), exe)
|
||||||
|
|
||||||
|
def test_executable_found_in_cft_layout(self):
|
||||||
|
# Playwright 1.64.1 的 CFT 包解压为 chrome-linux64/chrome。
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
exe_dir = os.path.join(
|
||||||
|
tmp, "chromium-1248", "chrome-linux64")
|
||||||
|
os.makedirs(exe_dir)
|
||||||
|
exe = os.path.join(exe_dir, "chrome")
|
||||||
|
open(exe, "w").write("x")
|
||||||
|
self.assertEqual(BROWSER.full_chromium_executable(tmp), exe)
|
||||||
|
self.assertTrue(BROWSER.full_chromium_present(tmp))
|
||||||
|
|
||||||
def test_status_reports_data_disk_dir(self):
|
def test_status_reports_data_disk_dir(self):
|
||||||
with tempfile.TemporaryDirectory() as tmp:
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
agent, _c, _h = _agent([FakePage()], tmp,
|
agent, _c, _h = _agent([FakePage()], tmp,
|
||||||
|
|||||||
Reference in new issue
Block a user