Skip to content

Commit 762fcb1

Browse files
author
emaryn
committed
vscode-extensions.ms-python.python: use vscode-extensions-update-script
1 parent 4f1a07b commit 762fcb1

File tree

1 file changed

+2
-36
lines changed
  • pkgs/applications/editors/vscode/extensions/ms-python.python

1 file changed

+2
-36
lines changed

pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
# Defaults to `false` as we expect it to be project specific most of the time.
99
pythonUseFixed ? false,
1010
# For updateScript
11-
writeScript,
12-
bash,
13-
curl,
14-
coreutils,
15-
gnused,
16-
jq,
17-
nix,
11+
vscode-extensions-update-script,
1812
}:
1913

2014
vscode-utils.buildVscodeMarketplaceExtension rec {
@@ -51,35 +45,7 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
5145
--replace-fail "\"default\":\"python\"" "\"default\":\"${python3.interpreter}\""
5246
'';
5347

54-
passthru.updateScript = writeScript "update" ''
55-
#! ${bash}/bin/bash
56-
57-
set -eu -o pipefail
58-
59-
export PATH=${
60-
lib.makeBinPath [
61-
curl
62-
coreutils
63-
gnused
64-
jq
65-
nix
66-
]
67-
}
68-
69-
api=$(curl -s 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
70-
-H 'accept: application/json;api-version=3.0-preview.1' \
71-
-H 'content-type: application/json' \
72-
--data-raw '{"filters":[{"criteria":[{"filterType":7,"value":"${mktplcRef.publisher}.${mktplcRef.name}"}]}],"flags":16}')
73-
# Find the latest version compatible with stable vscode version
74-
version=$(echo $api | jq -r '.results[0].extensions[0].versions | map(select(has("properties"))) | map(select(.properties | map(select(.key == "Microsoft.VisualStudio.Code.Engine")) | .[0].value | test("\\^[0-9.]+$"))) | .[0].version')
75-
76-
if [[ $version != ${mktplcRef.version} ]]; then
77-
tmp=$(mktemp)
78-
curl -sLo $tmp $(echo ${(import ../mktplcExtRefToFetchArgs.nix mktplcRef).url} | sed "s|${mktplcRef.version}|$version|")
79-
hash=$(nix hash file --type sha256 --base32 --sri $tmp)
80-
sed -i -e "s|${mktplcRef.hash}|$hash|" -e "s|${mktplcRef.version}|$version|" pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix
81-
fi
82-
'';
48+
passthru.updateScript = vscode-extensions-update-script { };
8349

8450
meta = {
8551
description = "Visual Studio Code extension with rich support for the Python language";

0 commit comments

Comments
 (0)