mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-21 19:53:06 +00:00
fix playwright and puppeteer install methods on linux
This commit is contained in:
parent
38cb1ac87b
commit
1768f147d4
3 changed files with 18 additions and 10 deletions
|
@ -149,14 +149,21 @@ class PlaywrightBinProvider(BaseBinProvider):
|
|||
|
||||
# print(f'[*] {self.__class__.__name__}: Installing {bin_name}: {self.INSTALLER_BIN_ABSPATH} install {packages}')
|
||||
|
||||
install_args = [*self.playwright_install_args]
|
||||
|
||||
proc = self.exec(bin_name=self.INSTALLER_BIN_ABSPATH, cmd=[*install_args, *packages])
|
||||
# playwright install-deps (to install system dependencies like fonts, graphics libraries, etc.)
|
||||
if platform.system().lower() != 'darwin':
|
||||
# libglib2.0-0, libnss3, libnspr4, libdbus-1-3, libatk1.0-0, libatk-bridge2.0-0, libcups2, libdrm2, libxcb1, libxkbcommon0, libatspi2.0-0, libx11-6, libxcomposite1, libxdamage1, libxext6, libxfixes3, libxrandr2, libgbm1, libcairo2, libasound2
|
||||
proc = self.exec(bin_name=self.INSTALLER_BIN_ABSPATH, cmd=['install-deps'])
|
||||
if proc.returncode != 0:
|
||||
print(proc.stdout.strip())
|
||||
print(proc.stderr.strip())
|
||||
|
||||
proc = self.exec(bin_name=self.INSTALLER_BIN_ABSPATH, cmd=['install', *packages])
|
||||
|
||||
if proc.returncode != 0:
|
||||
print(proc.stdout.strip())
|
||||
print(proc.stderr.strip())
|
||||
raise Exception(f"{self.__class__.__name__}: install got returncode {proc.returncode} while installing {packages}: {packages}")
|
||||
raise Exception(f"{self.__class__.__name__}: install got returncode {proc.returncode} while installing {packages}: {packages} PACKAGES={packages}")
|
||||
|
||||
# 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
|
||||
# playwright build v1010 downloaded to /home/squash/.cache/ms-playwright/ffmpeg-1010
|
||||
|
@ -168,13 +175,12 @@ class PlaywrightBinProvider(BaseBinProvider):
|
|||
and 'ffmpeg' not in line
|
||||
]
|
||||
if output_lines:
|
||||
relpath = output_lines[0].split(self.playwright_browsers_dir)[-1]
|
||||
relpath = output_lines[0].split(str(self.playwright_browsers_dir))[-1]
|
||||
abspath = self.playwright_browsers_dir / relpath
|
||||
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()
|
||||
return (proc.stderr.strip() + "\n" + proc.stdout.strip()).strip()
|
||||
|
||||
PLAYWRIGHT_BINPROVIDER = PlaywrightBinProvider()
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ class PuppeteerBinProvider(BaseBinProvider):
|
|||
return sorted(self.puppeteer_browsers_dir.glob(f'{browser_name}/mac*/chrome*/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing'))
|
||||
|
||||
# /data/lib/browsers/chrome/linux-131.0.6730.0/chrome-linux64/chrome
|
||||
# /data/lib/aarch64-linux/browsers/chrome/linux-129.0.6668.100/chrome-linux64/chrome
|
||||
return sorted(self.puppeteer_browsers_dir.glob(f"{browser_name}/linux*/chrome*/chrome"))
|
||||
|
||||
def default_abspath_handler(self, bin_name: BinName, **context) -> Optional[HostBinPath]:
|
||||
|
@ -102,7 +103,7 @@ class PuppeteerBinProvider(BaseBinProvider):
|
|||
if matching_bins:
|
||||
newest_bin = matching_bins[-1] # already sorted alphabetically, last should theoretically be highest version number
|
||||
self._browser_abspaths[bin_name] = newest_bin
|
||||
return self._browser_abspaths[bin_name]
|
||||
return newest_bin
|
||||
|
||||
return None
|
||||
|
||||
|
@ -129,8 +130,9 @@ 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.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
|
||||
# /data/lib/aarch64-linux/browsers/chrome/linux-129.0.6668.100/chrome-linux64/chrome
|
||||
relpath = proc.stdout.strip().split(str(self.puppeteer_browsers_dir))[-1].split('\n', 1)[0]
|
||||
abspath = self.puppeteer_browsers_dir / relpath
|
||||
|
||||
|
@ -138,7 +140,7 @@ class PuppeteerBinProvider(BaseBinProvider):
|
|||
self._browser_abspaths[bin_name] = abspath
|
||||
return abspath
|
||||
|
||||
return proc.stderr.strip() + "\n" + proc.stdout.strip()
|
||||
return (proc.stderr.strip() + "\n" + proc.stdout.strip()).strip()
|
||||
|
||||
PUPPETEER_BINPROVIDER = PuppeteerBinProvider()
|
||||
|
||||
|
|
2
archivebox/vendor/pydantic-pkgr
vendored
2
archivebox/vendor/pydantic-pkgr
vendored
|
@ -1 +1 @@
|
|||
Subproject commit ad3c0ca457951d4d0852b46020fc6365b75e5065
|
||||
Subproject commit 59ec81566120f8c0c86a6a35b4be91c25d43096d
|
Loading…
Reference in a new issue