Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkgs/development/python-modules/playwright/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ let
in
buildPythonPackage rec {
pname = "playwright";
version = "1.32.1";
# run ./pkgs/development/python-modules/playwright/update.sh to update
version = "1.34.0";
format = "setuptools";
disabled = pythonOlder "3.7";

src = fetchFromGitHub {
owner = "microsoft";
repo = "playwright-python";
rev = "v${version}";
hash = "sha256-rguobFaepTOL2duHRdFV5o2JSsBlYiA7rY3/RyHvoMc=";
hash = "sha256-GIxMVuSSJsRDsHDOPnJsDsTcghGYtIFpRS5u7HJd+zY=";
};

patches = [
Expand Down
12 changes: 8 additions & 4 deletions pkgs/development/python-modules/playwright/update.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused nix-prefetch common-updater-scripts
#!nix-shell -i bash -p curl gnused nix-prefetch common-updater-scripts node2nix
set -euo pipefail

root="$(dirname "$(readlink -f "$0")")"
driver_file="$root/../../web/playwright/driver.nix"
playwright_test="$root/../../web/playwright-test"

version=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s https://api.github.com/repos/microsoft/playwright-python/releases/latest | jq -r '.tag_name | sub("^v"; "")')

Expand All @@ -13,11 +15,11 @@ setup_py_url="https://github.com/microsoft/playwright-python/raw/v${version}/set
driver_version=$(curl -Ls "$setup_py_url" | grep '^driver_version =' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')

fetch_driver_arch() {
nix-prefetch-url "https://playwright.azureedge.net/builds/driver/playwright-${version}-${1}.zip"
nix-prefetch-url "https://playwright.azureedge.net/builds/driver/playwright-${driver_version}-${1}.zip"
}

replace_sha() {
sed -i "s|$1 = \".\{44,52\}\"|$1 = \"$2\"|" "$root/default.nix"
sed -i "s|$1 = \".\{44,52\}\"|$1 = \"$2\"|" "$driver_file"
}

# Replace SHAs for the driver downloads
Expand All @@ -27,5 +29,7 @@ replace_sha "aarch64-linux" "$(fetch_driver_arch "linux-arm64")"
replace_sha "aarch64-darwin" "$(fetch_driver_arch "mac-arm64")"

# Update the version stamps
sed -i "s/driverVersion = \"[^\$]*\"/driverVersion = \"$driver_version\"/" "$root/default.nix"
sed -i "s/version =\s*\"[^\$]*\"/version = \"$driver_version\"/" "$driver_file"
sed -i "s/\"@playwright\/test\": \"[^\$]*\"/\"@playwright\/test\": \"$driver_version\"/" "$playwright_test/node-packages.json"
(cd "$playwright_test"; node2nix -i node-packages.json)
update-source-version playwright "$version" --rev="v$version"
2 changes: 1 addition & 1 deletion pkgs/development/web/playwright-test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stop using node2nix if possible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is buildNpmPackage the encouraged function then ? I had trouble for some packages where node2nix succeeded (possibly playwright but I dont remember).

{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}:

let
nodeEnv = import ./node-env.nix {
Expand Down
7 changes: 5 additions & 2 deletions pkgs/development/web/playwright-test/node-env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,15 @@ let
then
ln -s $out/lib/node_modules/.bin $out/bin

# Patch the shebang lines of all the executables
# Fixup all executables
ls $out/bin/* | while read i
do
file="$(readlink -f "$i")"
chmod u+rwx "$file"
patchShebangs "$file"
if isScript "$file"
then
sed -i 's/\r$//' "$file" # convert crlf to lf
fi
done
fi

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/web/playwright-test/node-packages.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[
{"@playwright/test": "1.31.1"}
{"@playwright/test": "1.34.3"}
]
28 changes: 14 additions & 14 deletions pkgs/development/web/playwright-test/node-packages.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions pkgs/development/web/playwright/driver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ let
in
{
pname = "playwright-driver";
version = "1.31.1";
# run ./pkgs/development/python-modules/playwright/update.sh to update
version = "1.34.3";

src = fetchurl {
url = "https://playwright.azureedge.net/builds/driver/${filename}";
sha256 = {
x86_64-linux = "1wg49kfs8fflmx8g01bkckbjkghhwy7c44akckjf7dp4lbh1z8fd";
aarch64-linux = "0f09a0cxqxihy8lmbjzii80jkpf3n5xlvhjpgdkwmrr3wh0nnixj";
x86_64-darwin = "1zd0dz8jazymcpa1im5yzxb7rwl6wn4xz19lpz83bnpd1njq01b3";
aarch64-darwin = "0hcn80zm9aki8hzsf1cljzcmi4iaw7fascs8ajj0qcwqkkm4jnw0";
x86_64-linux = "1xh05v3yqa8gkwayhl4nffgjcnlakpyyi17hwzh0wqzrbwwn0cs8";
aarch64-linux = "18jxbmhiqda5pzrv6b3n7xi14xg4zvlh6sn7hc3b3hckl77vl933";
x86_64-darwin = "0fy5nxbvp1kxplavj832gxiznjqpvl0ww869hsfj0h1fibhly7cy";
aarch64-darwin = "11msl4pnmr8cmlw32xq2qvfz3g3fy0azvq134a47c0fnpj2gd5zl";
}.${system} or throwSystem;
};

Expand Down