mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
Merge pull request #1254 from c01o/dev
This commit is contained in:
commit
851f59b4ba
3 changed files with 25 additions and 21 deletions
|
@ -107,6 +107,7 @@ ls ./archive/*/index.json # or browse directly via the filesyste
|
||||||
# Quickstart
|
# Quickstart
|
||||||
|
|
||||||
**🖥 Supported OSs:** Linux/BSD, macOS, Windows (Docker/WSL) **👾 CPUs:** amd64, x86, arm8, arm7 <sup>(raspi>=3)</sup>
|
**🖥 Supported OSs:** Linux/BSD, macOS, Windows (Docker/WSL) **👾 CPUs:** amd64, x86, arm8, arm7 <sup>(raspi>=3)</sup>
|
||||||
|
<i>Note: On arm7, the `playwright` package, provides easy `chromium` management, is not yet available. Do it manually with alternative methods.</i>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
|
@ -976,27 +976,30 @@ def setup(out_dir: Path=OUTPUT_DIR) -> None:
|
||||||
stderr(f'[X] Failed to install python packages: {e}', color='red')
|
stderr(f'[X] Failed to install python packages: {e}', color='red')
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
stderr('\n Installing CHROME_BINARY automatically using playwright...')
|
if platform.machine() == 'armv7l':
|
||||||
if CHROME_VERSION:
|
stderr('\n Skip the automatic installation of CHROME_BINARY because playwright is not available on armv7.')
|
||||||
print(f'{CHROME_VERSION} is already installed', CHROME_BINARY)
|
|
||||||
else:
|
else:
|
||||||
try:
|
stderr('\n Installing CHROME_BINARY automatically using playwright...')
|
||||||
run_shell([
|
if CHROME_VERSION:
|
||||||
PYTHON_BINARY, '-m', 'pip',
|
print(f'{CHROME_VERSION} is already installed', CHROME_BINARY)
|
||||||
'install',
|
else:
|
||||||
'--upgrade',
|
try:
|
||||||
'--no-cache-dir',
|
run_shell([
|
||||||
'--no-warn-script-location',
|
PYTHON_BINARY, '-m', 'pip',
|
||||||
'playwright',
|
'install',
|
||||||
], capture_output=False, cwd=out_dir)
|
'--upgrade',
|
||||||
run_shell([PYTHON_BINARY, '-m', 'playwright', 'install', 'chromium'], capture_output=False, cwd=out_dir)
|
'--no-cache-dir',
|
||||||
proc = run_shell([PYTHON_BINARY, '-c', 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)'], capture_output=True, text=True, cwd=out_dir)
|
'--no-warn-script-location',
|
||||||
NEW_CHROME_BINARY = proc.stdout.decode().strip() if isinstance(proc.stdout, bytes) else proc.stdout.strip()
|
'playwright',
|
||||||
assert NEW_CHROME_BINARY and len(NEW_CHROME_BINARY), 'CHROME_BINARY must contain a path'
|
], capture_output=False, cwd=out_dir)
|
||||||
config(f'CHROME_BINARY={NEW_CHROME_BINARY}', set=True, out_dir=out_dir)
|
run_shell([PYTHON_BINARY, '-m', 'playwright', 'install', 'chromium'], capture_output=False, cwd=out_dir)
|
||||||
except BaseException as e: # lgtm [py/catch-base-exception]
|
proc = run_shell([PYTHON_BINARY, '-c', 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)'], capture_output=True, text=True, cwd=out_dir)
|
||||||
stderr(f'[X] Failed to install chromium using playwright: {e.__class__.__name__} {e}', color='red')
|
NEW_CHROME_BINARY = proc.stdout.decode().strip() if isinstance(proc.stdout, bytes) else proc.stdout.strip()
|
||||||
raise SystemExit(1)
|
assert NEW_CHROME_BINARY and len(NEW_CHROME_BINARY), 'CHROME_BINARY must contain a path'
|
||||||
|
config(f'CHROME_BINARY={NEW_CHROME_BINARY}', set=True, out_dir=out_dir)
|
||||||
|
except BaseException as e: # lgtm [py/catch-base-exception]
|
||||||
|
stderr(f'[X] Failed to install chromium using playwright: {e.__class__.__name__} {e}', color='red')
|
||||||
|
raise SystemExit(1)
|
||||||
|
|
||||||
stderr('\n Installing SINGLEFILE_BINARY, READABILITY_BINARY, MERCURY_BINARY automatically using npm...')
|
stderr('\n Installing SINGLEFILE_BINARY, READABILITY_BINARY, MERCURY_BINARY automatically using npm...')
|
||||||
if not NODE_VERSION:
|
if not NODE_VERSION:
|
||||||
|
|
|
@ -18,7 +18,7 @@ dependencies = [
|
||||||
"w3lib>=1.22.0",
|
"w3lib>=1.22.0",
|
||||||
# "youtube-dl>=2021.04.17",
|
# "youtube-dl>=2021.04.17",
|
||||||
"yt-dlp>=2021.4.11",
|
"yt-dlp>=2021.4.11",
|
||||||
"playwright>=1.39.0",
|
"playwright>=1.39.0; platform_machine != 'armv7l'",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
Loading…
Reference in a new issue