about summary refs log tree commit diff
path: root/pkgs/development/python-modules/playwright
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/playwright')
-rw-r--r--pkgs/development/python-modules/playwright/default.nix4
-rw-r--r--pkgs/development/python-modules/playwright/driver-location.patch20
2 files changed, 13 insertions, 11 deletions
diff --git a/pkgs/development/python-modules/playwright/default.nix b/pkgs/development/python-modules/playwright/default.nix
index 12b98826b7a71..42472024e0201 100644
--- a/pkgs/development/python-modules/playwright/default.nix
+++ b/pkgs/development/python-modules/playwright/default.nix
@@ -12,6 +12,7 @@
   setuptools,
   setuptools-scm,
   playwright-driver,
+  nodejs,
 }:
 
 let
@@ -64,7 +65,8 @@ buildPythonPackage rec {
 
     # Set the correct driver path with the help of a patch in patches
     substituteInPlace playwright/_impl/_driver.py \
-      --replace "@driver@" "${driver}/bin/playwright"
+      --replace-fail "@node@" "${lib.getExe nodejs}" \
+      --replace-fail "@driver@" "${driver}/package/cli.js"
   '';
 
   nativeBuildInputs = [
diff --git a/pkgs/development/python-modules/playwright/driver-location.patch b/pkgs/development/python-modules/playwright/driver-location.patch
index a7f79840c65db..033b785e4eed3 100644
--- a/pkgs/development/python-modules/playwright/driver-location.patch
+++ b/pkgs/development/python-modules/playwright/driver-location.patch
@@ -1,22 +1,22 @@
 diff --git a/playwright/_impl/_driver.py b/playwright/_impl/_driver.py
-index f3b911f..d00e509 100644
+index 9e8cdc1..7ee382d 100644
 --- a/playwright/_impl/_driver.py
 +++ b/playwright/_impl/_driver.py
 @@ -23,11 +23,7 @@ from playwright._repo_version import version
  
  
- def compute_driver_executable() -> Path:
--    package_path = Path(inspect.getfile(playwright)).parent
--    platform = sys.platform
--    if platform == "win32":
--        return package_path / "driver" / "playwright.cmd"
--    return package_path / "driver" / "playwright.sh"
-+   return Path("@driver@")
+ def compute_driver_executable() -> Tuple[str, str]:
+-    driver_path = Path(inspect.getfile(playwright)).parent / "driver"
+-    cli_path = str(driver_path / "package" / "cli.js")
+-    if sys.platform == "win32":
+-        return (str(driver_path / "node.exe"), cli_path)
+-    return (os.getenv("PLAYWRIGHT_NODEJS_PATH", str(driver_path / "node")), cli_path)
++   return "@node@", "@driver@"
  
  
- if sys.version_info.major == 3 and sys.version_info.minor == 7:
+ def get_driver_env() -> dict:
 diff --git a/setup.py b/setup.py
-index 3487a6a..05112c2 100644
+index 8709e52..59784dd 100644
 --- a/setup.py
 +++ b/setup.py
 @@ -141,25 +141,8 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand):