mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-17 00:24:26 -04:00
add user providable PLAYWRIGHT cache dir
This commit is contained in:
parent
48f8416762
commit
758c0c6774
1 changed files with 8 additions and 7 deletions
|
@ -25,10 +25,16 @@ import abx
|
||||||
|
|
||||||
from .binaries import PLAYWRIGHT_BINARY
|
from .binaries import PLAYWRIGHT_BINARY
|
||||||
|
|
||||||
|
USER_PLAYWRIGHT_CACHE_DIR: str | None = os.environ.get("PLAYWRIGHT_BROWSERS_PATH", None)
|
||||||
MACOS_PLAYWRIGHT_CACHE_DIR: Path = Path("~/Library/Caches/ms-playwright")
|
MACOS_PLAYWRIGHT_CACHE_DIR: Path = Path("~/Library/Caches/ms-playwright")
|
||||||
LINUX_PLAYWRIGHT_CACHE_DIR: Path = Path("~/.cache/ms-playwright")
|
LINUX_PLAYWRIGHT_CACHE_DIR: Path = Path("~/.cache/ms-playwright")
|
||||||
|
|
||||||
|
PLAYWRIGHT_CACHE_DIR: Path = Path(USER_PLAYWRIGHT_CACHE_DIR) if USER_PLAYWRIGHT_CACHE_DIR else (
|
||||||
|
MACOS_PLAYWRIGHT_CACHE_DIR.expanduser()
|
||||||
|
if OPERATING_SYSTEM == "darwin" else
|
||||||
|
LINUX_PLAYWRIGHT_CACHE_DIR.expanduser()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PlaywrightBinProvider(BinProvider):
|
class PlaywrightBinProvider(BinProvider):
|
||||||
name: BinProviderName = "playwright"
|
name: BinProviderName = "playwright"
|
||||||
|
@ -36,11 +42,7 @@ class PlaywrightBinProvider(BinProvider):
|
||||||
|
|
||||||
PATH: PATHStr = f"{Path('/usr/share/abx') / 'bin'}:{DEFAULT_ENV_PATH}"
|
PATH: PATHStr = f"{Path('/usr/share/abx') / 'bin'}:{DEFAULT_ENV_PATH}"
|
||||||
|
|
||||||
playwright_browsers_dir: Path = (
|
playwright_browsers_dir: Path = PLAYWRIGHT_CACHE_DIR
|
||||||
MACOS_PLAYWRIGHT_CACHE_DIR.expanduser()
|
|
||||||
if OPERATING_SYSTEM == "darwin" else
|
|
||||||
LINUX_PLAYWRIGHT_CACHE_DIR.expanduser()
|
|
||||||
)
|
|
||||||
playwright_install_args: List[str] = ["install"]
|
playwright_install_args: List[str] = ["install"]
|
||||||
|
|
||||||
packages_handler: BinProviderOverrides = Field(default={
|
packages_handler: BinProviderOverrides = Field(default={
|
||||||
|
@ -49,7 +51,6 @@ class PlaywrightBinProvider(BinProvider):
|
||||||
|
|
||||||
_browser_abspaths: ClassVar[Dict[str, HostBinPath]] = {}
|
_browser_abspaths: ClassVar[Dict[str, HostBinPath]] = {}
|
||||||
|
|
||||||
@computed_field
|
|
||||||
@property
|
@property
|
||||||
def INSTALLER_BIN_ABSPATH(self) -> HostBinPath | None:
|
def INSTALLER_BIN_ABSPATH(self) -> HostBinPath | None:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue