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):
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}")