fix playwright and puppeteer browser detection after install

This commit is contained in:
Nick Sweeting 2024-10-09 03:46:28 -07:00
parent 6100685cbb
commit 31c66a1068
No known key found for this signature in database
6 changed files with 35 additions and 28 deletions

View file

@ -1,5 +1,6 @@
__package__ = 'archivebox.plugins_pkg.puppeteer'
import os
import platform
from pathlib import Path
from typing import List, Optional, Dict, ClassVar
@ -128,12 +129,14 @@ class PuppeteerBinProvider(BaseBinProvider):
print(proc.stderr.strip())
raise Exception(f"{self.__class__.__name__}: install got returncode {proc.returncode} while installing {packages}: {packages}")
# to proceed? (y) chrome@129.0.6668.91 /tmp/test3/lib/x86_64-linux/browsers/chrome/linux-129.0.6668.91/chrome-linux64/chrome
# chrome@129.0.6668.58 /data/lib/browsers/chrome/mac_arm-129.0.6668.58/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
output_info = proc.stdout.strip().split('\n')[-1]
browser_abspath = output_info.split(' ', 1)[-1]
# browser_version = output_info.split('@', 1)[-1].split(' ', 1)[0]
relpath = proc.stdout.strip().split(str(self.puppeteer_browsers_dir))[-1]
abspath = self.puppeteer_browsers_dir / relpath
self._browser_abspaths[bin_name] = Path(browser_abspath)
if os.path.isfile(abspath) and os.access(abspath, os.X_OK):
self._browser_abspaths[bin_name] = abspath
return abspath
return proc.stderr.strip() + "\n" + proc.stdout.strip()