summary refs log tree commit diff
path: root/pkgs/applications/editors/kakoune
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2021-07-30 02:25:15 +0200
committerMatthieu Coudron <mcoudron@hotmail.com>2021-08-12 01:14:58 +0200
commit8ddad244eaa91af08ad041291c598a67acfe806b (patch)
tree8e36d835f3e8b3e57664ce4e4bc4c0aca9de8c0a /pkgs/applications/editors/kakoune
parent4b88ab8c5cc3afd36e24224b16740082a91bd3f2 (diff)
downloadnixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.tar
nixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.tar.gz
nixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.tar.bz2
nixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.tar.lz
nixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.tar.xz
nixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.tar.zst
nixpkgs-8ddad244eaa91af08ad041291c598a67acfe806b.zip
update-luarocks-packages: use pluginupdate.py
Cleans up the common interface between the updaters.
Restores the ability to regen the lua packages in parallel.
Diffstat (limited to 'pkgs/applications/editors/kakoune')
-rwxr-xr-xpkgs/applications/editors/kakoune/plugins/update.py79
1 files changed, 42 insertions, 37 deletions
diff --git a/pkgs/applications/editors/kakoune/plugins/update.py b/pkgs/applications/editors/kakoune/plugins/update.py
index b6a4bfe4f41..40a28d9afe2 100755
--- a/pkgs/applications/editors/kakoune/plugins/update.py
+++ b/pkgs/applications/editors/kakoune/plugins/update.py
@@ -39,52 +39,57 @@ in lib.filterAttrs (n: v: v != null) checksums)"""
 
 HEADER = "# This file has been generated by ./pkgs/applications/editors/kakoune/plugins/update.py. Do not edit!"
 
+class KakouneEditor(pluginupdate.Editor):
 
-def generate_nix(plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: str):
-    sorted_plugins = sorted(plugins, key=lambda v: v[2].name.lower())
 
-    with open(outfile, "w+") as f:
-        f.write(HEADER)
-        f.write(
-            """
-{ lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
-let
-  packages = ( self:
-{"""
-        )
-        for owner, repo, plugin in sorted_plugins:
-            if plugin.has_submodules:
-                submodule_attr = "\n      fetchSubmodules = true;"
-            else:
-                submodule_attr = ""
+    def generate_nix(plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: str):
+        sorted_plugins = sorted(plugins, key=lambda v: v[2].name.lower())
 
+        with open(outfile, "w+") as f:
+            f.write(HEADER)
             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}
+                """
+    { lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
+    let
+    packages = ( self:
+    {"""
+            )
+            for owner, repo, plugin in sorted_plugins:
+                if plugin.has_submodules:
+                    submodule_attr = "\n      fetchSubmodules = true;"
+                else:
+                    submodule_attr = ""
+
+                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}/";
     }};
-    meta.homepage = "https://github.com/{owner}/{repo}/";
-  }};
-"""
+    """
+                )
+            f.write(
+                """
+    });
+    in lib.fix' (lib.extends overrides packages)
+    """
             )
-        f.write(
-            """
-});
-in lib.fix' (lib.extends overrides packages)
-"""
-        )
-    print(f"updated {outfile}")
+        print(f"updated {outfile}")
 
 
 def main():
-    editor = pluginupdate.Editor("kakoune", ROOT, GET_PLUGINS, generate_nix)
-    pluginupdate.update_plugins(editor)
+    editor = KakouneEditor("kakoune", ROOT, GET_PLUGINS)
+    parser = editor.create_parser()
+    args = parser.parse_args()
+
+    pluginupdate.update_plugins(editor, args)
 
 
 if __name__ == "__main__":