about summary refs log tree commit diff
path: root/maintainers/scripts
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2022-05-02 00:58:41 +0200
committerMatthieu Coudron <mcoudron@hotmail.com>2022-05-03 00:22:03 +0200
commitd4894355c114e6950d7cb844c0220c91098cf479 (patch)
tree104f4d7559c6b97110bf10d4e18f51ba79eb712d /maintainers/scripts
parentb9e29b16bae4a8bf92e993d18caa1f33be634961 (diff)
vim/update.py: distinguish between vim/neovim plugins
I've been working for a long time towards automatic nix dependencies for
neovim plugins (using luarocks rockspecs to discover the said
dependencies).
This is an initial commit to help me complete the missing bits.
buildNeovimPluginFrom2Nix is right now a placeholder which helps me test
in my fork a version that does a flat install of luarocks.

the vim updater will now check for attributes with the same name in the lua package set,
if that's the case the script will generate buildNeovimPluginFrom2Nix.
Diffstat (limited to 'maintainers/scripts')
-rw-r--r--maintainers/scripts/pluginupdate.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/maintainers/scripts/pluginupdate.py b/maintainers/scripts/pluginupdate.py
index b24d75a6b4d0d..55eda3c7d45d7 100644
--- a/maintainers/scripts/pluginupdate.py
+++ b/maintainers/scripts/pluginupdate.py
@@ -311,6 +311,16 @@ def load_plugins_from_csv(config: FetchConfig, input_file: Path,) -> List[Plugin
 
     return plugins
 
+def run_nix_expr(expr):
+    with CleanEnvironment():
+        cmd = ["nix", "eval", "--extra-experimental-features",
+                "nix-command", "--impure", "--json", "--expr", expr]
+        log.debug("Running command %s", cmd)
+        out = subprocess.check_output(cmd)
+    data = json.loads(out)
+    return data
+
+
 class Editor:
     """The configuration of the update script."""
 
@@ -333,13 +343,9 @@ class Editor:
         self.deprecated = deprecated or root.joinpath("deprecated.json")
         self.cache_file = cache_file or f"{name}-plugin-cache.json"
 
-    def get_current_plugins(editor) -> List[Plugin]:
+    def get_current_plugins(self) -> List[Plugin]:
         """To fill the cache"""
-        with CleanEnvironment():
-            cmd = ["nix", "eval", "--extra-experimental-features", "nix-command", "--impure", "--json", "--expr", editor.get_plugins]
-            log.debug("Running command %s", cmd)
-            out = subprocess.check_output(cmd)
-        data = json.loads(out)
+        data = run_nix_expr(self.get_plugins)
         plugins = []
         for name, attr in data.items():
             print("get_current_plugins: name %s" % name)