Loading nixos/tests/playwright-python.nix +7 −6 Original line number Diff line number Diff line Loading @@ -25,19 +25,20 @@ import ./make-test-python.nix ( from playwright.sync_api import expect browsers = { "chromium": ["--headless", "--disable-gpu"], "firefox": [], "webkit": [] "chromium": {'args': ["--headless", "--disable-gpu"], 'channel': 'chromium'}, "firefox": {}, "webkit": {} } if len(sys.argv) != 3 or sys.argv[1] not in browsers.keys(): print(f"usage: {sys.argv[0]} [{'|'.join(browsers.keys())}] <url>") sys.exit(1) browser_name = sys.argv[1] url = sys.argv[2] browser_args = browsers.get(browser_name) print(f"Running test on {browser_name} {' '.join(browser_args)}") browser_kwargs = browsers.get(browser_name) args = ' '.join(browser_kwargs.get('args', [])) print(f"Running test on {browser_name} {args}") with sync_playwright() as p: browser = getattr(p, browser_name).launch(args=browser_args) browser = getattr(p, browser_name).launch(**browser_kwargs) context = browser.new_context() page = context.new_page() page.goto(url) Loading pkgs/development/python-modules/playwright/default.nix +10 −8 Original line number Diff line number Diff line Loading @@ -22,15 +22,15 @@ in buildPythonPackage rec { pname = "playwright"; # run ./pkgs/development/python-modules/playwright/update.sh to update version = "1.49.1"; version = "1.50.0"; pyproject = true; disabled = pythonOlder "3.7"; disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "microsoft"; repo = "playwright-python"; tag = "v${version}"; hash = "sha256-RwUjFofC/scwVClKncYWp3RbIUeKsWokVjcGibdrrtc="; hash = "sha256-g32QwEA4Ofzh7gVEsC++uA/XqT1eIrUH+fQi15SRxko="; }; patches = [ Loading @@ -52,13 +52,12 @@ buildPythonPackage rec { git commit -m "workaround setuptools-scm" substituteInPlace pyproject.toml \ --replace 'requires = ["setuptools==75.5.0", "setuptools-scm==8.1.0", "wheel==0.45.0", "auditwheel==6.1.0"]' \ --replace-fail 'requires = ["setuptools==75.6.0", "setuptools-scm==8.1.0", "wheel==0.45.1", "auditwheel==6.2.0"]' \ 'requires = ["setuptools", "setuptools-scm", "wheel"]' # Skip trying to download and extract the driver. # setup.py downloads and extracts the driver. # This is done manually in postInstall instead. substituteInPlace setup.py \ --replace "self._download_and_extract_local_driver(base_wheel_bundles)" "" rm setup.py # Set the correct driver path with the help of a patch in patches substituteInPlace playwright/_impl/_driver.py \ Loading Loading @@ -101,6 +100,9 @@ buildPythonPackage rec { // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit (nixosTests) playwright-python; }; # Package and playwright driver versions are tightly coupled. # Use the update script to ensure synchronized updates. skipBulkUpdate = true; updateScript = ./update.sh; }; Loading pkgs/development/python-modules/playwright/driver-location.patch +0 −20 Original line number Diff line number Diff line Loading @@ -18,23 +18,3 @@ index 22b53b8..2d86626 100644 def get_driver_env() -> dict: diff --git a/setup.py b/setup.py index f4c93dc..15c2d06 100644 --- a/setup.py +++ b/setup.py @@ -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] pkgs/development/python-modules/playwright/update.sh +11 −5 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ update_browser() { suffix="mac" fi else if [ "$name" = "ffmpeg" ]; then if [ "$name" = "ffmpeg" ] || [ "$name" = "chromium-headless-shell" ]; then suffix="linux" elif [ "$name" = "firefox" ]; then stripRoot="true" Loading @@ -56,12 +56,17 @@ update_browser() { fi fi aarch64_suffix="$suffix-arm64" if [ "$name" = "chromium-headless-shell" ]; then buildname="chromium"; else buildname="$name" fi revision="$(jq -r ".browsers.$name.revision" "$playwright_dir/browsers.json")" revision="$(jq -r ".browsers[\"$buildname\"].revision" "$playwright_dir/browsers.json")" replace_sha "$playwright_dir/$name.nix" "x86_64-$platform" \ "$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$suffix.zip" $stripRoot)" "$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$suffix.zip" $stripRoot)" replace_sha "$playwright_dir/$name.nix" "aarch64-$platform" \ "$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$aarch64_suffix.zip" $stripRoot)" "$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$aarch64_suffix.zip" $stripRoot)" } curl -fsSl \ Loading @@ -77,12 +82,13 @@ curl -fsSl \ ' > "$playwright_dir/browsers.json" # We currently use Chromium from nixpkgs, so we don't need to download it here # Likewise, darwin can be ignored here atm as we are using an impure install anyway. update_browser "chromium-headless-shell" "linux" update_browser "firefox" "linux" update_browser "webkit" "linux" update_browser "ffmpeg" "linux" update_browser "chromium" "darwin" update_browser "chromium-headless-shell" "darwin" update_browser "firefox" "darwin" update_browser "webkit" "darwin" update_browser "ffmpeg" "darwin" Loading pkgs/development/web/playwright/browsers.json +12 −8 Original line number Diff line number Diff line Loading @@ -2,27 +2,31 @@ "comment": "This file is kept up to date via update.sh", "browsers": { "chromium": { "revision": "1140", "browserVersion": "130.0.6723.31" "revision": "1155", "browserVersion": "133.0.6943.16" }, "firefox": { "revision": "1465", "browserVersion": "131.0" "revision": "1471", "browserVersion": "134.0" }, "webkit": { "revision": "2083", "revision": "2123", "revisionOverrides": { "debian11-x64": "2105", "debian11-arm64": "2105", "mac10.14": "1446", "mac10.15": "1616", "mac11": "1816", "mac11-arm64": "1816", "mac12": "2009", "mac12-arm64": "2009" "mac12-arm64": "2009", "ubuntu20.04-x64": "2092", "ubuntu20.04-arm64": "2092" }, "browserVersion": "18.0" "browserVersion": "18.2" }, "ffmpeg": { "revision": "1010", "revision": "1011", "revisionOverrides": { "mac12": "1010", "mac12-arm64": "1010" Loading Loading
nixos/tests/playwright-python.nix +7 −6 Original line number Diff line number Diff line Loading @@ -25,19 +25,20 @@ import ./make-test-python.nix ( from playwright.sync_api import expect browsers = { "chromium": ["--headless", "--disable-gpu"], "firefox": [], "webkit": [] "chromium": {'args': ["--headless", "--disable-gpu"], 'channel': 'chromium'}, "firefox": {}, "webkit": {} } if len(sys.argv) != 3 or sys.argv[1] not in browsers.keys(): print(f"usage: {sys.argv[0]} [{'|'.join(browsers.keys())}] <url>") sys.exit(1) browser_name = sys.argv[1] url = sys.argv[2] browser_args = browsers.get(browser_name) print(f"Running test on {browser_name} {' '.join(browser_args)}") browser_kwargs = browsers.get(browser_name) args = ' '.join(browser_kwargs.get('args', [])) print(f"Running test on {browser_name} {args}") with sync_playwright() as p: browser = getattr(p, browser_name).launch(args=browser_args) browser = getattr(p, browser_name).launch(**browser_kwargs) context = browser.new_context() page = context.new_page() page.goto(url) Loading
pkgs/development/python-modules/playwright/default.nix +10 −8 Original line number Diff line number Diff line Loading @@ -22,15 +22,15 @@ in buildPythonPackage rec { pname = "playwright"; # run ./pkgs/development/python-modules/playwright/update.sh to update version = "1.49.1"; version = "1.50.0"; pyproject = true; disabled = pythonOlder "3.7"; disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "microsoft"; repo = "playwright-python"; tag = "v${version}"; hash = "sha256-RwUjFofC/scwVClKncYWp3RbIUeKsWokVjcGibdrrtc="; hash = "sha256-g32QwEA4Ofzh7gVEsC++uA/XqT1eIrUH+fQi15SRxko="; }; patches = [ Loading @@ -52,13 +52,12 @@ buildPythonPackage rec { git commit -m "workaround setuptools-scm" substituteInPlace pyproject.toml \ --replace 'requires = ["setuptools==75.5.0", "setuptools-scm==8.1.0", "wheel==0.45.0", "auditwheel==6.1.0"]' \ --replace-fail 'requires = ["setuptools==75.6.0", "setuptools-scm==8.1.0", "wheel==0.45.1", "auditwheel==6.2.0"]' \ 'requires = ["setuptools", "setuptools-scm", "wheel"]' # Skip trying to download and extract the driver. # setup.py downloads and extracts the driver. # This is done manually in postInstall instead. substituteInPlace setup.py \ --replace "self._download_and_extract_local_driver(base_wheel_bundles)" "" rm setup.py # Set the correct driver path with the help of a patch in patches substituteInPlace playwright/_impl/_driver.py \ Loading Loading @@ -101,6 +100,9 @@ buildPythonPackage rec { // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit (nixosTests) playwright-python; }; # Package and playwright driver versions are tightly coupled. # Use the update script to ensure synchronized updates. skipBulkUpdate = true; updateScript = ./update.sh; }; Loading
pkgs/development/python-modules/playwright/driver-location.patch +0 −20 Original line number Diff line number Diff line Loading @@ -18,23 +18,3 @@ index 22b53b8..2d86626 100644 def get_driver_env() -> dict: diff --git a/setup.py b/setup.py index f4c93dc..15c2d06 100644 --- a/setup.py +++ b/setup.py @@ -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]
pkgs/development/python-modules/playwright/update.sh +11 −5 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ update_browser() { suffix="mac" fi else if [ "$name" = "ffmpeg" ]; then if [ "$name" = "ffmpeg" ] || [ "$name" = "chromium-headless-shell" ]; then suffix="linux" elif [ "$name" = "firefox" ]; then stripRoot="true" Loading @@ -56,12 +56,17 @@ update_browser() { fi fi aarch64_suffix="$suffix-arm64" if [ "$name" = "chromium-headless-shell" ]; then buildname="chromium"; else buildname="$name" fi revision="$(jq -r ".browsers.$name.revision" "$playwright_dir/browsers.json")" revision="$(jq -r ".browsers[\"$buildname\"].revision" "$playwright_dir/browsers.json")" replace_sha "$playwright_dir/$name.nix" "x86_64-$platform" \ "$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$suffix.zip" $stripRoot)" "$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$suffix.zip" $stripRoot)" replace_sha "$playwright_dir/$name.nix" "aarch64-$platform" \ "$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$aarch64_suffix.zip" $stripRoot)" "$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$aarch64_suffix.zip" $stripRoot)" } curl -fsSl \ Loading @@ -77,12 +82,13 @@ curl -fsSl \ ' > "$playwright_dir/browsers.json" # We currently use Chromium from nixpkgs, so we don't need to download it here # Likewise, darwin can be ignored here atm as we are using an impure install anyway. update_browser "chromium-headless-shell" "linux" update_browser "firefox" "linux" update_browser "webkit" "linux" update_browser "ffmpeg" "linux" update_browser "chromium" "darwin" update_browser "chromium-headless-shell" "darwin" update_browser "firefox" "darwin" update_browser "webkit" "darwin" update_browser "ffmpeg" "darwin" Loading
pkgs/development/web/playwright/browsers.json +12 −8 Original line number Diff line number Diff line Loading @@ -2,27 +2,31 @@ "comment": "This file is kept up to date via update.sh", "browsers": { "chromium": { "revision": "1140", "browserVersion": "130.0.6723.31" "revision": "1155", "browserVersion": "133.0.6943.16" }, "firefox": { "revision": "1465", "browserVersion": "131.0" "revision": "1471", "browserVersion": "134.0" }, "webkit": { "revision": "2083", "revision": "2123", "revisionOverrides": { "debian11-x64": "2105", "debian11-arm64": "2105", "mac10.14": "1446", "mac10.15": "1616", "mac11": "1816", "mac11-arm64": "1816", "mac12": "2009", "mac12-arm64": "2009" "mac12-arm64": "2009", "ubuntu20.04-x64": "2092", "ubuntu20.04-arm64": "2092" }, "browserVersion": "18.0" "browserVersion": "18.2" }, "ffmpeg": { "revision": "1010", "revision": "1011", "revisionOverrides": { "mac12": "1010", "mac12-arm64": "1010" Loading