From a0cce8a31a159f96e32f1f94e4b8725b6fee9f21 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 19 Jan 2025 21:17:08 +0100 Subject: [PATCH] python3Packages.playwright: 1.48.0 -> 1.49.1 --- .../python-modules/playwright/default.nix | 10 ++-- .../playwright/driver-location.patch | 48 ++++++++----------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/pkgs/development/python-modules/playwright/default.nix b/pkgs/development/python-modules/playwright/default.nix index c505c93c6b3a..0937fc0269c5 100644 --- a/pkgs/development/python-modules/playwright/default.nix +++ b/pkgs/development/python-modules/playwright/default.nix @@ -22,7 +22,7 @@ in buildPythonPackage rec { pname = "playwright"; # run ./pkgs/development/python-modules/playwright/update.sh to update - version = "1.48.0"; + version = "1.49.1"; pyproject = true; disabled = pythonOlder "3.7"; @@ -30,7 +30,7 @@ buildPythonPackage rec { owner = "microsoft"; repo = "playwright-python"; tag = "v${version}"; - hash = "sha256-ZWVySGehR5r6s0y6qCZuFI8SobYbjWP+A6Rgfug2JEE="; + hash = "sha256-RwUjFofC/scwVClKncYWp3RbIUeKsWokVjcGibdrrtc="; }; patches = [ @@ -51,12 +51,8 @@ buildPythonPackage rec { git config --global user.name "nixpkgs" git commit -m "workaround setuptools-scm" - substituteInPlace setup.py \ - --replace "setuptools-scm==8.1.0" "setuptools-scm" \ - --replace-fail "wheel==0.42.0" "wheel" - substituteInPlace pyproject.toml \ - --replace 'requires = ["setuptools==68.2.2", "setuptools-scm==8.1.0", "wheel==0.42.0", "auditwheel==5.4.0"]' \ + --replace 'requires = ["setuptools==75.5.0", "setuptools-scm==8.1.0", "wheel==0.45.0", "auditwheel==6.1.0"]' \ 'requires = ["setuptools", "setuptools-scm", "wheel"]' # Skip trying to download and extract the driver. diff --git a/pkgs/development/python-modules/playwright/driver-location.patch b/pkgs/development/python-modules/playwright/driver-location.patch index 87e193f6812e..096b9f5ba6e7 100644 --- a/pkgs/development/python-modules/playwright/driver-location.patch +++ b/pkgs/development/python-modules/playwright/driver-location.patch @@ -3,8 +3,8 @@ index 22b53b8..2d86626 100644 --- a/playwright/_impl/_driver.py +++ b/playwright/_impl/_driver.py @@ -23,14 +23,7 @@ from playwright._repo_version import version - - + + def compute_driver_executable() -> Tuple[str, str]: - driver_path = Path(inspect.getfile(playwright)).parent / "driver" - cli_path = str(driver_path / "package" / "cli.js") @@ -15,36 +15,26 @@ index 22b53b8..2d86626 100644 - ) - return (os.getenv("PLAYWRIGHT_NODEJS_PATH", str(driver_path / "node")), cli_path) + return "@node@", "@driver@" - - + + def get_driver_env() -> dict: diff --git a/setup.py b/setup.py -index 8709e52..59784dd 100644 +index f4c93dc..15c2d06 100644 --- a/setup.py +++ b/setup.py -@@ -141,25 +141,8 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand): +@@ -113,7 +113,6 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand): + super().run() + os.makedirs("driver", exist_ok=True) + os.makedirs("playwright/driver", exist_ok=True) +- self._download_and_extract_local_driver() + + wheel = None + if os.getenv("PLAYWRIGHT_TARGET_WHEEL", None): +@@ -139,6 +138,7 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand): + self, + wheel_bundle: Dict[str, str], + ) -> None: ++ return + assert self.dist_dir base_wheel_location: str = glob.glob(os.path.join(self.dist_dir, "*.whl"))[0] without_platform = base_wheel_location[:-7] - for wheel_bundle in wheels: -- download_driver(wheel_bundle["zip_name"]) -- zip_file = ( -- f"driver/playwright-{driver_version}-{wheel_bundle['zip_name']}.zip" -- ) -- with zipfile.ZipFile(zip_file, "r") as zip: -- extractall(zip, f"driver/{wheel_bundle['zip_name']}") - wheel_location = without_platform + wheel_bundle["wheel"] - shutil.copy(base_wheel_location, wheel_location) -- with zipfile.ZipFile(wheel_location, "a") as zip: -- driver_root = os.path.abspath(f"driver/{wheel_bundle['zip_name']}") -- for dir_path, _, files in os.walk(driver_root): -- for file in files: -- from_path = os.path.join(dir_path, file) -- to_path = os.path.relpath(from_path, driver_root) -- zip.write(from_path, f"playwright/driver/{to_path}") -- zip.writestr( -- "playwright/driver/README.md", -- f"{wheel_bundle['wheel']} driver package", -- ) - os.remove(base_wheel_location) - if InWheel: - for whlfile in glob.glob(os.path.join(self.dist_dir, "*.whl")):