Skip to content

Commit b47698a

Browse files
committed
PuppeteerProvider: add browser_cache_dir field override
The computed ``cache_dir = install_root/cache`` default works for the managed lib-dir layout but forced downstream plugins to treat ``PUPPETEER_CACHE_DIR`` as ``install_root.parent``, which broke callers that pin the cache at an arbitrary path (e.g. ``lib/puppeteer/chrome``). Add a writable ``browser_cache_dir`` field that wins over the computed default so hooks can pass the user-configured PUPPETEER_CACHE_DIR through to the provider verbatim while still using ``install_root`` / ``bin_dir`` for metadata and shim locations.
1 parent d84304d commit b47698a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

abxpkg/binprovider_puppeteer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class PuppeteerProvider(BinProvider):
6666
# Only set in managed mode: setup()/default_abspath_handler() use it to expose stable
6767
# browser launch shims under ``<install_root>/bin``; global mode leaves it unset.
6868
bin_dir: Path | None = None
69+
# Explicit override for the directory browsers get downloaded into. When
70+
# unset, cache_dir defaults to ``<install_root>/cache``; when set, it wins
71+
# so callers can point ``PUPPETEER_CACHE_DIR`` at an arbitrary path.
72+
browser_cache_dir: Path | None = None
6973

7074
@computed_field
7175
@property
@@ -80,7 +84,10 @@ def supports_postinstall_disable(self, action, no_cache: bool = False) -> bool:
8084
@computed_field
8185
@property
8286
def cache_dir(self) -> Path | None:
83-
# Browser downloads always live under ``install_root/cache`` when we
87+
# Explicit override wins so PUPPETEER_CACHE_DIR can be any path.
88+
if self.browser_cache_dir is not None:
89+
return self.browser_cache_dir
90+
# Otherwise browser downloads live under ``install_root/cache`` when we
8491
# manage an install root; global mode leaves cache ownership to the host.
8592
if self.install_root is not None:
8693
return self.install_root / "cache"

0 commit comments

Comments
 (0)