From 762fcb12a961d8bdbc0e8417a4cf9fb3ae52bc02 Mon Sep 17 00:00:00 2001 From: emaryn Date: Tue, 25 Mar 2025 18:51:11 +0000 Subject: [PATCH] vscode-extensions.ms-python.python: use vscode-extensions-update-script --- .../extensions/ms-python.python/default.nix | 38 +------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix b/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix index df96b37116c9..4904c2494e70 100644 --- a/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix +++ b/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix @@ -8,13 +8,7 @@ # Defaults to `false` as we expect it to be project specific most of the time. pythonUseFixed ? false, # For updateScript - writeScript, - bash, - curl, - coreutils, - gnused, - jq, - nix, + vscode-extensions-update-script, }: vscode-utils.buildVscodeMarketplaceExtension rec { @@ -51,35 +45,7 @@ vscode-utils.buildVscodeMarketplaceExtension rec { --replace-fail "\"default\":\"python\"" "\"default\":\"${python3.interpreter}\"" ''; - passthru.updateScript = writeScript "update" '' - #! ${bash}/bin/bash - - set -eu -o pipefail - - export PATH=${ - lib.makeBinPath [ - curl - coreutils - gnused - jq - nix - ] - } - - api=$(curl -s 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \ - -H 'accept: application/json;api-version=3.0-preview.1' \ - -H 'content-type: application/json' \ - --data-raw '{"filters":[{"criteria":[{"filterType":7,"value":"${mktplcRef.publisher}.${mktplcRef.name}"}]}],"flags":16}') - # Find the latest version compatible with stable vscode version - 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') - - if [[ $version != ${mktplcRef.version} ]]; then - tmp=$(mktemp) - curl -sLo $tmp $(echo ${(import ../mktplcExtRefToFetchArgs.nix mktplcRef).url} | sed "s|${mktplcRef.version}|$version|") - hash=$(nix hash file --type sha256 --base32 --sri $tmp) - sed -i -e "s|${mktplcRef.hash}|$hash|" -e "s|${mktplcRef.version}|$version|" pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix - fi - ''; + passthru.updateScript = vscode-extensions-update-script { }; meta = { description = "Visual Studio Code extension with rich support for the Python language";