Skip to content

Commit 752e7e1

Browse files
committed
Se añade playwright install-deps
1 parent 695621a commit 752e7e1

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

fabricator/recipes.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,39 @@ def install_deps(c: Connection | DockerRunner | Context, config: dict) -> None:
241241
pty=True
242242
)
243243

244-
# Install Playwright browsers
245-
logger.info("Installing Playwright browsers...")
246-
c.run(
244+
# Install Playwright browsers if playwright is installed
245+
logger.info("Checking if Playwright is installed...")
246+
playwright_check = c.run(
247247
f"bash -c 'source {venv_dir}/bin/activate && "
248248
f"cd {deploy_path} && "
249-
f"playwright install'",
250-
pty=True
249+
f"python -c \"import playwright; print('playwright installed')\"'",
250+
pty=True,
251+
warn=True,
252+
hide=True
251253
)
252254

255+
if playwright_check and playwright_check.ok:
256+
logger.info("Installing Playwright browsers...")
257+
c.run(
258+
f"bash -c 'source {venv_dir}/bin/activate && "
259+
f"cd {deploy_path} && "
260+
f"playwright install'",
261+
pty=True
262+
)
263+
264+
logger.info("Installing Playwright system dependencies...")
265+
c.run(
266+
f"bash -c 'source {venv_dir}/bin/activate && "
267+
f"cd {deploy_path} && "
268+
f"playwright install-deps'",
269+
pty=True
270+
)
271+
else:
272+
logger.info(
273+
"Playwright not found in requirements, "
274+
"skipping browser installation."
275+
)
276+
253277
def migrate(c: Connection | DockerRunner | Context, config: dict) -> None:
254278
"""
255279
Run Django migrations and optionally run `db_seed`.

0 commit comments

Comments
 (0)