From 2df2a508dc3b072ef9b0f6e537084e1d29010484 Mon Sep 17 00:00:00 2001 From: Andrew Abbott Date: Mon, 18 Apr 2022 10:32:07 +1000 Subject: [PATCH] kakounePlugins: Fix update.py I tried to run this and it failed. These changes made it work again. I looked at maintainers/scripts/pluginupdate.py and how the types differed to make this fix. --- .../editors/kakoune/plugins/update.py | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/pkgs/applications/editors/kakoune/plugins/update.py b/pkgs/applications/editors/kakoune/plugins/update.py index dd8765db28a4..49662a0e8e2e 100755 --- a/pkgs/applications/editors/kakoune/plugins/update.py +++ b/pkgs/applications/editors/kakoune/plugins/update.py @@ -42,19 +42,19 @@ HEADER = "# This file has been generated by ./pkgs/applications/editors/kakoune/ class KakouneEditor(pluginupdate.Editor): - def generate_nix(self, plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: str): - sorted_plugins = sorted(plugins, key=lambda v: v[2].name.lower()) + def generate_nix(self, plugins: List[Tuple[pluginupdate.PluginDesc, pluginupdate.Plugin]], outfile: str): + sorted_plugins = sorted(plugins, key=lambda v: v[1].name.lower()) with open(outfile, "w+") as f: f.write(HEADER) f.write( """ - { lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }: - let - packages = ( self: - {""" +{ lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }: +let +packages = ( self: +{""" ) - for owner, repo, plugin in sorted_plugins: + for pluginDesc, plugin in sorted_plugins: if plugin.has_submodules: submodule_attr = "\n fetchSubmodules = true;" else: @@ -62,24 +62,19 @@ class KakouneEditor(pluginupdate.Editor): f.write( f""" - {plugin.normalized_name} = buildKakounePluginFrom2Nix {{ - pname = "{plugin.normalized_name}"; - version = "{plugin.version}"; - src = fetchFromGitHub {{ - owner = "{owner}"; - repo = "{repo}"; - rev = "{plugin.commit}"; - sha256 = "{plugin.sha256}";{submodule_attr} - }}; - meta.homepage = "https://github.com/{owner}/{repo}/"; - }}; - """ + {plugin.normalized_name} = buildKakounePluginFrom2Nix {{ + pname = "{plugin.normalized_name}"; + version = "{plugin.version}"; + src = {pluginDesc.repo.as_nix(plugin)}; + meta.homepage = "{pluginDesc.repo.url("")}"; + }}; +""" ) f.write( """ - }); - in lib.fix' (lib.extends overrides packages) - """ +}); +in lib.fix' (lib.extends overrides packages) +""" ) print(f"updated {outfile}")