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.
This commit is contained in:
Andrew Abbott 2022-04-18 10:32:07 +10:00
parent 1db06ff354
commit 2df2a508dc

View File

@ -42,19 +42,19 @@ HEADER = "# This file has been generated by ./pkgs/applications/editors/kakoune/
class KakouneEditor(pluginupdate.Editor): class KakouneEditor(pluginupdate.Editor):
def generate_nix(self, plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: str): def generate_nix(self, plugins: List[Tuple[pluginupdate.PluginDesc, pluginupdate.Plugin]], outfile: str):
sorted_plugins = sorted(plugins, key=lambda v: v[2].name.lower()) sorted_plugins = sorted(plugins, key=lambda v: v[1].name.lower())
with open(outfile, "w+") as f: with open(outfile, "w+") as f:
f.write(HEADER) f.write(HEADER)
f.write( f.write(
""" """
{ lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }: { lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
let let
packages = ( self: packages = ( self:
{""" {"""
) )
for owner, repo, plugin in sorted_plugins: for pluginDesc, plugin in sorted_plugins:
if plugin.has_submodules: if plugin.has_submodules:
submodule_attr = "\n fetchSubmodules = true;" submodule_attr = "\n fetchSubmodules = true;"
else: else:
@ -62,24 +62,19 @@ class KakouneEditor(pluginupdate.Editor):
f.write( f.write(
f""" f"""
{plugin.normalized_name} = buildKakounePluginFrom2Nix {{ {plugin.normalized_name} = buildKakounePluginFrom2Nix {{
pname = "{plugin.normalized_name}"; pname = "{plugin.normalized_name}";
version = "{plugin.version}"; version = "{plugin.version}";
src = fetchFromGitHub {{ src = {pluginDesc.repo.as_nix(plugin)};
owner = "{owner}"; meta.homepage = "{pluginDesc.repo.url("")}";
repo = "{repo}"; }};
rev = "{plugin.commit}"; """
sha256 = "{plugin.sha256}";{submodule_attr}
}};
meta.homepage = "https://github.com/{owner}/{repo}/";
}};
"""
) )
f.write( f.write(
""" """
}); });
in lib.fix' (lib.extends overrides packages) in lib.fix' (lib.extends overrides packages)
""" """
) )
print(f"updated {outfile}") print(f"updated {outfile}")