From 1dde052d3c8b180a310688121c815e6cd3e85a2b Mon Sep 17 00:00:00 2001 From: linsui Date: Thu, 29 Sep 2022 10:28:05 +0800 Subject: [PATCH] vscode-extensions.ms-python.python: 2022.11.11881005 -> 2022.15.12711056 --- .../vscode/extensions/python/default.nix | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/editors/vscode/extensions/python/default.nix b/pkgs/applications/editors/vscode/extensions/python/default.nix index 8ca353c8479a..e72c89511aed 100644 --- a/pkgs/applications/editors/vscode/extensions/python/default.nix +++ b/pkgs/applications/editors/vscode/extensions/python/default.nix @@ -6,14 +6,21 @@ # Use version from `PATH` for default setting otherwise. # Defaults to `false` as we expect it to be project specific most of the time. , pythonUseFixed ? false + # For updateScript +, writeScript +, bash +, curl +, coreutils +, gnused +, nix }: -vscode-utils.buildVscodeMarketplaceExtension { +vscode-utils.buildVscodeMarketplaceExtension rec { mktplcRef = { name = "python"; publisher = "ms-python"; - version = "2022.11.11881005"; - sha256 = "sha256-8NH/aWIAwSpVRi3cvBCpvO8MVzIoRaXxADmWp6DuUb8="; + version = "2022.15.12711056"; + sha256 = "sha256-bksUMN+ZdkmElVD8BC4ihklQyWlKkcpep2VOwUzISnQ="; }; buildInputs = [ icu ]; @@ -41,7 +48,37 @@ vscode-utils.buildVscodeMarketplaceExtension { --replace "\"default\": \"python\"" "\"default\": \"${python3.interpreter}\"" ''; + passthru.updateScript = writeScript "update" '' + #! ${bash}/bin/bash + + set -eu -o pipefail + + export PATH=${lib.makeBinPath [ + curl + coreutils + gnused + 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":512}') + version=$(echo $api | sed -n -E 's|^.*"version":"([0-9.]+)".*$|\1|p') + + 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.sha256}|$hash|" -e "s|${mktplcRef.version}|$version|" pkgs/applications/editors/vscode/extensions/python/default.nix + fi + ''; + meta = with lib; { + description = "A Visual Studio Code extension with rich support for the Python language"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-python.python"; + homepage = "https://github.com/Microsoft/vscode-python"; + changelog = "https://github.com/microsoft/vscode-python/releases"; license = licenses.mit; platforms = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; maintainers = with maintainers; [ jraygauthier jfchevrette ];