diff options
author | Gaetan Lepage <gaetan@glepage.com> | 2023-10-16 13:32:33 +0200 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-10-16 16:10:53 +0200 |
commit | be4d94890e639be870e525c2158308b9bd39278b (patch) | |
tree | 12d53171a69399b8d7369968a65159b54a4e4ab8 /pkgs/applications | |
parent | 86e3c2f58e54c8588643972d41a2ee9197634057 (diff) |
vimPluginsUpdater: fix nvim-treesitter grammars update
Diffstat (limited to 'pkgs/applications')
-rwxr-xr-x | pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py | 9 | ||||
-rwxr-xr-x | pkgs/applications/editors/vim/plugins/update.py | 10 |
2 files changed, 12 insertions, 7 deletions
diff --git a/pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py b/pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py index 6d9fd4de0984e..4b70d8555dd2e 100755 --- a/pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py +++ b/pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py @@ -63,14 +63,14 @@ def update_grammars(nvim_treesitter_dir: str): generated_file = """# generated by pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py - { buildGrammar, """ +{ buildGrammar, """ generated_file += subprocess.check_output(["nurl", "-Ls", ", "], text=True) generated_file += """ }: - { - """ +{ +""" lockfile_path = os.path.join(nvim_treesitter_dir, "lockfile.json") log.debug("Opening %s", lockfile_path) @@ -88,7 +88,8 @@ def update_grammars(nvim_treesitter_dir: str): _generate_grammar, lockfile.items() ): generated_file += generated - generated_file += "}\n" + + generated_file += "}\n" return generated_file diff --git a/pkgs/applications/editors/vim/plugins/update.py b/pkgs/applications/editors/vim/plugins/update.py index b658ca7e2bd92..e7e50c21d475e 100755 --- a/pkgs/applications/editors/vim/plugins/update.py +++ b/pkgs/applications/editors/vim/plugins/update.py @@ -138,15 +138,19 @@ class VimEditor(pluginupdate.Editor): nvim_treesitter_dir = subprocess.check_output(cmd, text=True, timeout=90).strip() generated = treesitter.update_grammars(nvim_treesitter_dir) - open(os.path.join(args.nixpkgs, "generated.nix"), "w").write(generated) + treesitter_generated_nix_path = os.path.join( + NIXPKGS_NVIMTREESITTER_FOLDER, + "generated.nix" + ) + open(os.path.join(args.nixpkgs, treesitter_generated_nix_path), "w").write(generated) if self.nixpkgs_repo: index = self.nixpkgs_repo.index for diff in index.diff(None): - if diff.a_path == f"{NIXPKGS_NVIMTREESITTER_FOLDER}/generated.nix": + if diff.a_path == treesitter_generated_nix_path: msg = "vimPlugins.nvim-treesitter: update grammars" print(f"committing to nixpkgs: {msg}") - index.add([str(nvim_treesitter_dir.joinpath("generated.nix"))]) + index.add([treesitter_generated_nix_path]) index.commit(msg) return print("no updates to nvim-treesitter grammars") |