Skip to content

Commit a09e851

Browse files
kalekseevteto
authored andcommitted
playwright: 1.48.1 -> 1.50.1
1 parent 8cd49c6 commit a09e851

File tree

11 files changed

+208
-71
lines changed

11 files changed

+208
-71
lines changed

nixos/tests/playwright-python.nix

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ import ./make-test-python.nix (
2525
from playwright.sync_api import expect
2626
2727
browsers = {
28-
"chromium": ["--headless", "--disable-gpu"],
29-
"firefox": [],
30-
"webkit": []
28+
"chromium": {'args': ["--headless", "--disable-gpu"], 'channel': 'chromium'},
29+
"firefox": {},
30+
"webkit": {}
3131
}
3232
if len(sys.argv) != 3 or sys.argv[1] not in browsers.keys():
3333
print(f"usage: {sys.argv[0]} [{'|'.join(browsers.keys())}] <url>")
3434
sys.exit(1)
3535
browser_name = sys.argv[1]
3636
url = sys.argv[2]
37-
browser_args = browsers.get(browser_name)
38-
print(f"Running test on {browser_name} {' '.join(browser_args)}")
37+
browser_kwargs = browsers.get(browser_name)
38+
args = ' '.join(browser_kwargs.get('args', []))
39+
print(f"Running test on {browser_name} {args}")
3940
with sync_playwright() as p:
40-
browser = getattr(p, browser_name).launch(args=browser_args)
41+
browser = getattr(p, browser_name).launch(**browser_kwargs)
4142
context = browser.new_context()
4243
page = context.new_page()
4344
page.goto(url)

pkgs/development/python-modules/playwright/default.nix

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ in
2222
buildPythonPackage rec {
2323
pname = "playwright";
2424
# run ./pkgs/development/python-modules/playwright/update.sh to update
25-
version = "1.49.1";
25+
version = "1.50.0";
2626
pyproject = true;
27-
disabled = pythonOlder "3.7";
27+
disabled = pythonOlder "3.9";
2828

2929
src = fetchFromGitHub {
3030
owner = "microsoft";
3131
repo = "playwright-python";
3232
tag = "v${version}";
33-
hash = "sha256-RwUjFofC/scwVClKncYWp3RbIUeKsWokVjcGibdrrtc=";
33+
hash = "sha256-g32QwEA4Ofzh7gVEsC++uA/XqT1eIrUH+fQi15SRxko=";
3434
};
3535

3636
patches = [
@@ -52,13 +52,12 @@ buildPythonPackage rec {
5252
git commit -m "workaround setuptools-scm"
5353
5454
substituteInPlace pyproject.toml \
55-
--replace 'requires = ["setuptools==75.5.0", "setuptools-scm==8.1.0", "wheel==0.45.0", "auditwheel==6.1.0"]' \
56-
'requires = ["setuptools", "setuptools-scm", "wheel"]'
55+
--replace-fail 'requires = ["setuptools==75.6.0", "setuptools-scm==8.1.0", "wheel==0.45.1", "auditwheel==6.2.0"]' \
56+
'requires = ["setuptools", "setuptools-scm", "wheel"]'
5757
58-
# Skip trying to download and extract the driver.
58+
# setup.py downloads and extracts the driver.
5959
# This is done manually in postInstall instead.
60-
substituteInPlace setup.py \
61-
--replace "self._download_and_extract_local_driver(base_wheel_bundles)" ""
60+
rm setup.py
6261
6362
# Set the correct driver path with the help of a patch in patches
6463
substituteInPlace playwright/_impl/_driver.py \
@@ -101,6 +100,9 @@ buildPythonPackage rec {
101100
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
102101
inherit (nixosTests) playwright-python;
103102
};
103+
# Package and playwright driver versions are tightly coupled.
104+
# Use the update script to ensure synchronized updates.
105+
skipBulkUpdate = true;
104106
updateScript = ./update.sh;
105107
};
106108

pkgs/development/python-modules/playwright/driver-location.patch

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,3 @@ index 22b53b8..2d86626 100644
1818

1919

2020
def get_driver_env() -> dict:
21-
diff --git a/setup.py b/setup.py
22-
index f4c93dc..15c2d06 100644
23-
--- a/setup.py
24-
+++ b/setup.py
25-
@@ -113,7 +113,6 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand):
26-
super().run()
27-
os.makedirs("driver", exist_ok=True)
28-
os.makedirs("playwright/driver", exist_ok=True)
29-
- self._download_and_extract_local_driver()
30-
31-
wheel = None
32-
if os.getenv("PLAYWRIGHT_TARGET_WHEEL", None):
33-
@@ -139,6 +138,7 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand):
34-
self,
35-
wheel_bundle: Dict[str, str],
36-
) -> None:
37-
+ return
38-
assert self.dist_dir
39-
base_wheel_location: str = glob.glob(os.path.join(self.dist_dir, "*.whl"))[0]
40-
without_platform = base_wheel_location[:-7]

pkgs/development/python-modules/playwright/update.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ update_browser() {
4646
suffix="mac"
4747
fi
4848
else
49-
if [ "$name" = "ffmpeg" ]; then
49+
if [ "$name" = "ffmpeg" ] || [ "$name" = "chromium-headless-shell" ]; then
5050
suffix="linux"
5151
elif [ "$name" = "firefox" ]; then
5252
stripRoot="true"
@@ -56,12 +56,17 @@ update_browser() {
5656
fi
5757
fi
5858
aarch64_suffix="$suffix-arm64"
59+
if [ "$name" = "chromium-headless-shell" ]; then
60+
buildname="chromium";
61+
else
62+
buildname="$name"
63+
fi
5964

60-
revision="$(jq -r ".browsers.$name.revision" "$playwright_dir/browsers.json")"
65+
revision="$(jq -r ".browsers[\"$buildname\"].revision" "$playwright_dir/browsers.json")"
6166
replace_sha "$playwright_dir/$name.nix" "x86_64-$platform" \
62-
"$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$suffix.zip" $stripRoot)"
67+
"$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$suffix.zip" $stripRoot)"
6368
replace_sha "$playwright_dir/$name.nix" "aarch64-$platform" \
64-
"$(prefetch_browser "https://playwright.azureedge.net/builds/$name/$revision/$name-$aarch64_suffix.zip" $stripRoot)"
69+
"$(prefetch_browser "https://playwright.azureedge.net/builds/$buildname/$revision/$name-$aarch64_suffix.zip" $stripRoot)"
6570
}
6671

6772
curl -fsSl \
@@ -77,12 +82,13 @@ curl -fsSl \
7782
' > "$playwright_dir/browsers.json"
7883

7984
# We currently use Chromium from nixpkgs, so we don't need to download it here
80-
# Likewise, darwin can be ignored here atm as we are using an impure install anyway.
85+
update_browser "chromium-headless-shell" "linux"
8186
update_browser "firefox" "linux"
8287
update_browser "webkit" "linux"
8388
update_browser "ffmpeg" "linux"
8489

8590
update_browser "chromium" "darwin"
91+
update_browser "chromium-headless-shell" "darwin"
8692
update_browser "firefox" "darwin"
8793
update_browser "webkit" "darwin"
8894
update_browser "ffmpeg" "darwin"

pkgs/development/web/playwright/browsers.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@
22
"comment": "This file is kept up to date via update.sh",
33
"browsers": {
44
"chromium": {
5-
"revision": "1140",
6-
"browserVersion": "130.0.6723.31"
5+
"revision": "1155",
6+
"browserVersion": "133.0.6943.16"
77
},
88
"firefox": {
9-
"revision": "1465",
10-
"browserVersion": "131.0"
9+
"revision": "1471",
10+
"browserVersion": "134.0"
1111
},
1212
"webkit": {
13-
"revision": "2083",
13+
"revision": "2123",
1414
"revisionOverrides": {
15+
"debian11-x64": "2105",
16+
"debian11-arm64": "2105",
1517
"mac10.14": "1446",
1618
"mac10.15": "1616",
1719
"mac11": "1816",
1820
"mac11-arm64": "1816",
1921
"mac12": "2009",
20-
"mac12-arm64": "2009"
22+
"mac12-arm64": "2009",
23+
"ubuntu20.04-x64": "2092",
24+
"ubuntu20.04-arm64": "2092"
2125
},
22-
"browserVersion": "18.0"
26+
"browserVersion": "18.2"
2327
},
2428
"ffmpeg": {
25-
"revision": "1010",
29+
"revision": "1011",
2630
"revisionOverrides": {
2731
"mac12": "1010",
2832
"mac12-arm64": "1010"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
fetchzip,
3+
revision,
4+
suffix,
5+
system,
6+
throwSystem,
7+
stdenv,
8+
autoPatchelfHook,
9+
patchelfUnstable,
10+
11+
alsa-lib,
12+
at-spi2-atk,
13+
glib,
14+
libXcomposite,
15+
libXdamage,
16+
libXfixes,
17+
libXrandr,
18+
libgbm,
19+
libgcc,
20+
libxkbcommon,
21+
nspr,
22+
nss,
23+
...
24+
}:
25+
let
26+
linux = stdenv.mkDerivation {
27+
name = "playwright-chromium-headless-shell";
28+
src = fetchzip {
29+
url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-headless-shell-${suffix}.zip";
30+
stripRoot = false;
31+
hash =
32+
{
33+
x86_64-linux = "sha256-UNLSiI9jWLev2YwqiXuoHwJfdB4teNhEfQjQRBEo8uY=";
34+
aarch64-linux = "sha256-aVGLcJHFER09frJdKsGW/pKPl5MXoXef2hy5WTA8rS4=";
35+
}
36+
.${system} or throwSystem;
37+
};
38+
39+
nativeBuildInputs = [
40+
autoPatchelfHook
41+
patchelfUnstable
42+
];
43+
44+
buildInputs = [
45+
alsa-lib
46+
at-spi2-atk
47+
glib
48+
libXcomposite
49+
libXdamage
50+
libXfixes
51+
libXrandr
52+
libgbm
53+
libgcc.lib
54+
libxkbcommon
55+
nspr
56+
nss
57+
];
58+
59+
buildPhase = ''
60+
cp -R . $out
61+
'';
62+
};
63+
64+
darwin = fetchzip {
65+
url = "https://playwright.azureedge.net/builds/chromium/${revision}/chromium-headless-shell-${suffix}.zip";
66+
stripRoot = false;
67+
hash =
68+
{
69+
x86_64-darwin = "sha256-c26ubAgM9gQPaYqobQyS3Y7wvMUmmdpDlrYmZJrUgho=";
70+
aarch64-darwin = "sha256-XRFqlhVx+GuDxz/kDP8TtyPQfR0JbFD0qu5OSywGTX8=";
71+
}
72+
.${system} or throwSystem;
73+
};
74+
in
75+
{
76+
x86_64-linux = linux;
77+
aarch64-linux = linux;
78+
x86_64-darwin = darwin;
79+
aarch64-darwin = darwin;
80+
}
81+
.${system} or throwSystem

pkgs/development/web/playwright/chromium.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ let
3434
stripRoot = false;
3535
hash =
3636
{
37-
x86_64-darwin = "sha256-N/uh3Q2ivqeraAqRt80deVz1XEPyLTYI8L3DBfNQGWg=";
38-
aarch64-darwin = "sha256-tR9PwGanPcsDQwi1BijeYJd9LhNIWgEoXs5u3gZpghU=";
37+
x86_64-darwin = "sha256-seMHD+TmxrfgsN6sLN2Bp3WgAooDnlSxGN6CPw1Q790=";
38+
aarch64-darwin = "sha256-SsIRzxTIuf/mwsYvRM2mv8PzWQAAflxOyoK5TuyhMAU=";
3939
}
4040
.${system} or throwSystem;
4141
};

pkgs/development/web/playwright/driver.nix

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ let
2727
}
2828
.${system} or throwSystem;
2929

30-
version = "1.48.1";
30+
version = "1.50.1";
3131

3232
src = fetchFromGitHub {
3333
owner = "Microsoft";
3434
repo = "playwright";
3535
rev = "v${version}";
36-
hash = "sha256-VMp/Tjd5w2v+IHD+CMaR/XdMJHkS/u7wFe0hNxa1TbE=";
36+
hash = "sha256-s4lJRdsA4H+Uf9LjriZ6OimBl5A9Pf4fvhWDw2kOMkg=";
3737
};
3838

3939
babel-bundle = buildNpmPackage {
4040
pname = "babel-bundle";
4141
inherit version src;
4242
sourceRoot = "${src.name}/packages/playwright/bundles/babel";
43-
npmDepsHash = "sha256-kHuNFgxmyIoxTmvT+cyzDRfKNy18zzeUH3T+gJopWeA=";
43+
npmDepsHash = "sha256-HrDTkP2lHl2XKD8aGpmnf6YtSe/w9UePH5W9QfbaoMg=";
4444
dontNpmBuild = true;
4545
installPhase = ''
4646
cp -r . "$out"
@@ -60,7 +60,7 @@ let
6060
pname = "utils-bundle";
6161
inherit version src;
6262
sourceRoot = "${src.name}/packages/playwright/bundles/utils";
63-
npmDepsHash = "sha256-d+nE11x/493BexI70mVbnZFLQClU88sscbNwruXjx1M=";
63+
npmDepsHash = "sha256-tyk9bv1ethQSm8PKDpLthwsmqJugLIpsUOf9G8TOKRc=";
6464
dontNpmBuild = true;
6565
installPhase = ''
6666
cp -r . "$out"
@@ -70,7 +70,7 @@ let
7070
pname = "utils-bundle-core";
7171
inherit version src;
7272
sourceRoot = "${src.name}/packages/playwright-core/bundles/utils";
73-
npmDepsHash = "sha256-aktxEDQKxsDcInyjDKDuIu4zwtrAH0lRda/mP1IayPA=";
73+
npmDepsHash = "sha256-TarWFVp5JFCKZIvBUTohzzsFaLZHV79lN5+G9+rCP8Y=";
7474
dontNpmBuild = true;
7575
installPhase = ''
7676
cp -r . "$out"
@@ -92,7 +92,7 @@ let
9292
inherit version src;
9393

9494
sourceRoot = "${src.name}"; # update.sh depends on sourceRoot presence
95-
npmDepsHash = "sha256-cmUmYuUL7zfB7WEBKft43r69f7vaZDEjku8uwR3RZ1A=";
95+
npmDepsHash = "sha256-RoKw3Ie41/4DsjCeqkMhKFyjDPuvMgxajZYZhRdiTuY=";
9696

9797
nativeBuildInputs = [ cacert ];
9898

@@ -163,6 +163,7 @@ let
163163
browsers-chromium = browsers {
164164
withFirefox = false;
165165
withWebkit = false;
166+
withChromiumHeadlessShell = false;
166167
};
167168
};
168169
});
@@ -198,13 +199,15 @@ let
198199
withFirefox ? true,
199200
withWebkit ? true,
200201
withFfmpeg ? true,
202+
withChromiumHeadlessShell ? true,
201203
fontconfig_file ? makeFontsConf {
202204
fontDirectories = [ ];
203205
},
204206
}:
205207
let
206208
browsers =
207209
lib.optionals withChromium [ "chromium" ]
210+
++ lib.optionals withChromiumHeadlessShell [ "chromium-headless-shell" ]
208211
++ lib.optionals withFirefox [ "firefox" ]
209212
++ lib.optionals withWebkit [ "webkit" ]
210213
++ lib.optionals withFfmpeg [ "ffmpeg" ];
@@ -214,11 +217,12 @@ let
214217
map (
215218
name:
216219
let
217-
value = playwright-core.passthru.browsersJSON.${name};
220+
revName = if name == "chromium-headless-shell" then "chromium" else name;
221+
value = playwright-core.passthru.browsersJSON.${revName};
218222
in
219223
lib.nameValuePair
220224
# TODO check platform for revisionOverrides
221-
"${name}-${value.revision}"
225+
"${lib.replaceStrings [ "-" ] [ "_" ] name}-${value.revision}"
222226
(
223227
callPackage (./. + "/${name}.nix") (
224228
{

pkgs/development/web/playwright/ffmpeg.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ fetchzip {
1010
stripRoot = false;
1111
hash =
1212
{
13-
x86_64-linux = "sha256-FEm62UvMv0h6Sav93WmbPLw3CW1L1xg4nD26ca5ol38=";
14-
aarch64-linux = "sha256-jtQ+NS++VHRiKoIV++PIxEnyVnYtVwUyNlSILKSH4A4=";
15-
x86_64-darwin = "sha256-ED6noxSDeEUt2DkIQ4gNe/kL+zHVeb2AD5klBk93F88=";
16-
aarch64-darwin = "sha256-3Adnvb7zvMXKFOhb8uuj5kx0wEIFicmckYx9WLlNNf0=";
13+
x86_64-linux = "sha256-AWTiui+ccKHxsIaQSgc5gWCJT5gYwIWzAEqSuKgVqZU=";
14+
aarch64-linux = "sha256-1mOKO2lcnlwLsC6ob//xKnKrCOp94pw8X14uBxCdj0Q=";
15+
x86_64-darwin = "sha256-zJ8BMzdneV6LlEt4I034l5u86dwW4UmO/UazWikpKV4=";
16+
aarch64-darwin = "sha256-ky10UQj+XPVGpaWAPvKd51C5brml0y9xQ6iKcrxAMRc=";
1717
}
1818
.${system} or throwSystem;
1919
}

0 commit comments

Comments
 (0)