pluginupdate.py: fix bugs and add improvements; vimPlugins: sort properly (#353786)

This commit is contained in:
Matthieu Coudron 2024-11-09 15:17:49 +01:00 committed by GitHub
commit a31f2a7b37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 544 additions and 533 deletions

View File

@ -4,7 +4,7 @@
# - pkgs/development/lua-modules/updater/updater.py
# format:
# $ nix run nixpkgs#black maintainers/scripts/pluginupdate.py
# $ nix run nixpkgs#ruff maintainers/scripts/pluginupdate.py
# type-check:
# $ nix run nixpkgs#python3.pkgs.mypy maintainers/scripts/pluginupdate.py
# linted:
@ -142,7 +142,7 @@ class Repo:
return loaded
def prefetch(self, ref: Optional[str]) -> str:
print("Prefetching %s", self.uri)
log.info("Prefetching %s", self.uri)
loaded = self._prefetch(ref)
return loaded["sha256"]
@ -195,7 +195,7 @@ class RepoGitHub(Repo):
xml = req.read()
# Filter out illegal XML characters
illegal_xml_regex = re.compile(b"[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]")
illegal_xml_regex = re.compile(b"[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]")
xml = illegal_xml_regex.sub(b"", xml)
root = ET.fromstring(xml)
@ -256,13 +256,7 @@ class PluginDesc:
@property
def name(self):
if self.alias is None:
return self.repo.name
else:
return self.alias
def __lt__(self, other):
return self.repo.name < other.repo.name
return self.alias or self.repo.name
@staticmethod
def load_from_csv(config: FetchConfig, row: Dict[str, str]) -> "PluginDesc":
@ -270,7 +264,12 @@ class PluginDesc:
branch = row["branch"]
repo = make_repo(row["repo"], branch.strip())
repo.token = config.github_token
return PluginDesc(repo, branch.strip(), row["alias"])
return PluginDesc(
repo,
branch.strip(),
# alias is usually an empty string
row["alias"] if row["alias"] else None,
)
@staticmethod
def load_from_string(config: FetchConfig, line: str) -> "PluginDesc":
@ -328,12 +327,11 @@ def load_plugins_from_csv(
return plugins
def run_nix_expr(expr, nixpkgs: str, **args):
'''
"""
:param expr nix expression to fetch current plugins
:param nixpkgs Path towards a nixpkgs checkout
'''
"""
with CleanEnvironment(nixpkgs) as nix_path:
cmd = [
"nix",
@ -382,16 +380,14 @@ class Editor:
fetch_config = FetchConfig(args.proc, args.github_token)
editor = self
for plugin_line in args.add_plugins:
log.debug("using plugin_line", plugin_line)
log.debug("using plugin_line %s", plugin_line)
pdesc = PluginDesc.load_from_string(fetch_config, plugin_line)
log.debug("loaded as pdesc", pdesc)
log.debug("loaded as pdesc %s", pdesc)
append = [pdesc]
editor.rewrite_input(
fetch_config, args.input_file, editor.deprecated, append=append
)
plugin, _ = prefetch_plugin(
pdesc,
)
plugin, _ = prefetch_plugin(pdesc)
autocommit = not args.no_commit
if autocommit:
commit(
@ -406,9 +402,9 @@ class Editor:
# Expects arguments generated by 'update' subparser
def update(self, args):
"""CSV spec"""
print("the update member function should be overriden in subclasses")
print("the update member function should be overridden in subclasses")
def get_current_plugins(self, nixpkgs) -> List[Plugin]:
def get_current_plugins(self, nixpkgs: str) -> List[Plugin]:
"""To fill the cache"""
data = run_nix_expr(self.get_plugins, nixpkgs)
plugins = []
@ -440,6 +436,7 @@ class Editor:
plugins, redirects = check_results(results)
plugins = sorted(plugins, key=lambda v: v[1].normalized_name)
self.generate_nix(plugins, outfile)
return redirects
@ -559,6 +556,7 @@ class Editor:
parser = self.create_parser()
args = parser.parse_args()
command = args.command or "update"
logging.basicConfig()
log.setLevel(LOG_LEVELS[args.debug])
log.info("Chose to run command: %s", command)
self.nixpkgs = args.nixpkgs
@ -591,25 +589,24 @@ def prefetch_plugin(
p: PluginDesc,
cache: "Optional[Cache]" = None,
) -> Tuple[Plugin, Optional[Repo]]:
repo, branch, alias = p.repo, p.branch, p.alias
name = alias or p.repo.name
commit = None
log.info(f"Fetching last commit for plugin {name} from {repo.uri}@{branch}")
commit, date = repo.latest_commit()
log.info(f"Fetching last commit for plugin {p.name} from {p.repo.uri}@{p.branch}")
commit, date = p.repo.latest_commit()
cached_plugin = cache[commit] if cache else None
if cached_plugin is not None:
log.debug("Cache hit !")
cached_plugin.name = name
log.debug(f"Cache hit for {p.name}!")
cached_plugin.name = p.name
cached_plugin.date = date
return cached_plugin, repo.redirect
return cached_plugin, p.repo.redirect
has_submodules = repo.has_submodules()
log.debug(f"prefetch {name}")
sha256 = repo.prefetch(commit)
has_submodules = p.repo.has_submodules()
log.debug(f"prefetch {p.name}")
sha256 = p.repo.prefetch(commit)
return (
Plugin(name, commit, has_submodules, sha256, date=date),
repo.redirect,
Plugin(p.name, commit, has_submodules, sha256, date=date),
p.repo.redirect,
)
@ -624,7 +621,7 @@ def print_download_error(plugin: PluginDesc, ex: Exception):
def check_results(
results: List[Tuple[PluginDesc, Union[Exception, Plugin], Optional[Repo]]]
results: List[Tuple[PluginDesc, Union[Exception, Plugin], Optional[Repo]]],
) -> Tuple[List[Tuple[PluginDesc, Plugin]], Redirects]:
""" """
failures: List[Tuple[PluginDesc, Exception]] = []
@ -642,10 +639,9 @@ def check_results(
print(f"{len(results) - len(failures)} plugins were checked", end="")
if len(failures) == 0:
print()
return plugins, redirects
else:
print(f", {len(failures)} plugin(s) could not be downloaded:\n")
log.error(f", {len(failures)} plugin(s) could not be downloaded:\n")
for plugin, exception in failures:
print_download_error(plugin, exception)
@ -738,10 +734,7 @@ def rewrite_input(
append: List[PluginDesc] = [],
):
log.info("Rewriting input file %s", input_file)
plugins = load_plugins_from_csv(
config,
input_file,
)
plugins = load_plugins_from_csv(config, input_file)
plugins.extend(append)
@ -753,15 +746,25 @@ def rewrite_input(
deprecations = json.load(f)
# TODO parallelize this step
for pdesc, new_repo in redirects.items():
log.info("Rewriting input file %s", input_file)
log.info("Resolving deprecated plugin %s -> %s", pdesc.name, new_repo.name)
new_pdesc = PluginDesc(new_repo, pdesc.branch, pdesc.alias)
old_plugin, _ = prefetch_plugin(pdesc)
new_plugin, _ = prefetch_plugin(new_pdesc)
if old_plugin.normalized_name != new_plugin.normalized_name:
deprecations[old_plugin.normalized_name] = {
"new": new_plugin.normalized_name,
"date": cur_date_iso,
}
# remove plugin from index file, so we won't add it to deprecations again
for i, plugin in enumerate(plugins):
if plugin.name == pdesc.name:
plugins.pop(i)
break
plugins.append(new_pdesc)
with open(deprecated, "w") as f:
json.dump(deprecations, f, indent=4, sort_keys=True)
f.write("\n")
@ -772,7 +775,7 @@ def rewrite_input(
fieldnames = ["repo", "branch", "alias"]
writer = csv.DictWriter(f, fieldnames, dialect="unix", quoting=csv.QUOTE_NONE)
writer.writeheader()
for plugin in sorted(plugins):
for plugin in sorted(plugins, key=lambda x: x.name):
writer.writerow(asdict(plugin))
@ -792,9 +795,11 @@ def update_plugins(editor: Editor, args):
log.info("Start updating plugins")
if args.proc > 1 and args.github_token == None:
log.warning("You have enabled parallel updates but haven't set a github token.\n"
"You may be hit with `HTTP Error 429: too many requests` as a consequence."
"Either set --proc=1 or --github-token=YOUR_TOKEN. ")
log.warning(
"You have enabled parallel updates but haven't set a github token.\n"
"You may be hit with `HTTP Error 429: too many requests` as a consequence."
"Either set --proc=1 or --github-token=YOUR_TOKEN. "
)
fetch_config = FetchConfig(args.proc, args.github_token)
update = editor.get_update(args.input_file, args.outfile, fetch_config)
@ -810,11 +815,9 @@ def update_plugins(editor: Editor, args):
if autocommit:
try:
repo = git.Repo(os.getcwd())
updated = datetime.now(tz=UTC).strftime('%Y-%m-%d')
updated = datetime.now(tz=UTC).strftime("%Y-%m-%d")
print(args.outfile)
commit(repo,
f"{editor.attr_path}: update on {updated}", [args.outfile]
)
commit(repo, f"{editor.attr_path}: update on {updated}", [args.outfile])
except git.InvalidGitRepositoryError as e:
print(f"Not in a git repository: {e}", file=sys.stderr)
sys.exit(1)

View File

@ -2,49 +2,63 @@
#!nix-shell update-shell.nix -i python3
# format:
# $ nix run nixpkgs.python3Packages.black -c black update.py
# $ nix run nixpkgs#python3Packages.ruff -- update.py
# type-check:
# $ nix run nixpkgs.python3Packages.mypy -c mypy update.py
# $ nix run nixpkgs#python3Packages.mypy -- update.py
# linted:
# $ nix run nixpkgs.python3Packages.flake8 -c flake8 --ignore E501,E265,E402 update.py
# $ nix run nixpkgs#python3Packages.flake8 -- --ignore E501,E265,E402 update.py
import inspect
import os
import sys
from typing import List, Tuple
from pathlib import Path
from typing import List, Tuple
# Import plugin update library from maintainers/scripts/pluginupdate.py
ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) # type: ignore
ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) # type: ignore
sys.path.insert(
0, os.path.join(ROOT.parent.parent.parent.parent.parent, "maintainers", "scripts")
)
import pluginupdate
GET_PLUGINS = f"""(with import <localpkgs> {{}};
GET_PLUGINS = f"""(
with import <localpkgs> {{ }};
let
inherit (kakouneUtils.override {{}}) buildKakounePluginFrom2Nix;
inherit (kakouneUtils.override {{ }}) buildKakounePluginFrom2Nix;
generated = callPackage {ROOT}/generated.nix {{
inherit buildKakounePluginFrom2Nix;
}};
hasChecksum = value: lib.isAttrs value && lib.hasAttrByPath ["src" "outputHash"] value;
getChecksum = name: value:
if hasChecksum value then {{
submodules = value.src.fetchSubmodules or false;
sha256 = value.src.outputHash;
rev = value.src.rev;
}} else null;
hasChecksum =
value:
lib.isAttrs value
&& lib.hasAttrByPath [
"src"
"outputHash"
] value;
getChecksum =
name: value:
if hasChecksum value then
{{
submodules = value.src.fetchSubmodules or false;
sha256 = value.src.outputHash;
rev = value.src.rev;
}}
else
null;
checksums = lib.mapAttrs getChecksum generated;
in lib.filterAttrs (n: v: v != null) checksums)"""
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!"
HEADER = "# This file has been generated by ./pkgs/applications/editors/kakoune/plugins/update.py. Do not edit!"
class KakouneEditor(pluginupdate.Editor):
def generate_nix(self, plugins: List[Tuple[pluginupdate.PluginDesc, pluginupdate.Plugin]], outfile: str):
sorted_plugins = sorted(plugins, key=lambda v: v[1].name.lower())
def generate_nix(
self,
plugins: List[Tuple[pluginupdate.PluginDesc, pluginupdate.Plugin]],
outfile: str,
):
with open(outfile, "w+") as f:
f.write(HEADER)
f.write(
@ -54,7 +68,7 @@ let
packages = ( self:
{"""
)
for pluginDesc, plugin in sorted_plugins:
for pluginDesc, plugin in plugins:
f.write(
f"""
{plugin.normalized_name} = buildKakounePluginFrom2Nix {{

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
# run with:
# $ nix run .\#vimPluginsUpdater
# format:
# $ nix run nixpkgs#python3Packages.black -- update.py
# $ nix run nixpkgs#python3Packages.ruff -- update.py
# type-check:
# $ nix run nixpkgs#python3Packages.mypy -- update.py
# linted:
@ -19,30 +19,24 @@
#
import inspect
import os
import logging
import textwrap
import json
import logging
import os
import subprocess
from typing import List, Tuple
import textwrap
from pathlib import Path
from typing import List, Tuple
log = logging.getLogger("vim-updater")
sh = logging.StreamHandler()
formatter = logging.Formatter("%(name)s:%(levelname)s: %(message)s")
sh.setFormatter(formatter)
log.addHandler(sh)
# Import plugin update library from maintainers/scripts/pluginupdate.py
ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
import pluginupdate
import importlib
from pluginupdate import run_nix_expr, PluginDesc
treesitter = importlib.import_module('nvim-treesitter.update')
import pluginupdate
from pluginupdate import PluginDesc, run_nix_expr
treesitter = importlib.import_module("nvim-treesitter.update")
HEADER = (
@ -56,17 +50,14 @@ class VimEditor(pluginupdate.Editor):
nvim_treesitter_updated = False
def generate_nix(
self,
plugins: List[Tuple[PluginDesc, pluginupdate.Plugin]],
outfile: str
self, plugins: List[Tuple[PluginDesc, pluginupdate.Plugin]], outfile: str
):
log.info("Generating nix code")
sorted_plugins = sorted(plugins, key=lambda v: v[0].name.lower())
log.debug("Loading nvim-treesitter revision from nix...")
nvim_treesitter_rev = pluginupdate.run_nix_expr(
"(import <localpkgs> { }).vimPlugins.nvim-treesitter.src.rev",
self.nixpkgs,
timeout=10
timeout=10,
)
GET_PLUGINS_LUA = """
@ -98,7 +89,7 @@ class VimEditor(pluginupdate.Editor):
"""
)
)
for pdesc, plugin in sorted_plugins:
for pdesc, plugin in plugins:
content = self.plugin2nix(pdesc, plugin, _isNeovimPlugin(plugin))
f.write(content)
if (
@ -109,8 +100,9 @@ class VimEditor(pluginupdate.Editor):
f.write("\n}\n")
print(f"updated {outfile}")
def plugin2nix(self, pdesc: PluginDesc, plugin: pluginupdate.Plugin, isNeovim: bool) -> str:
def plugin2nix(
self, pdesc: PluginDesc, plugin: pluginupdate.Plugin, isNeovim: bool
) -> str:
repo = pdesc.repo
content = f" {plugin.normalized_name} = "
@ -138,19 +130,25 @@ class VimEditor(pluginupdate.Editor):
if self.nvim_treesitter_updated:
print("updating nvim-treesitter grammars")
cmd = [
"nix", "build",
"vimPlugins.nvim-treesitter.src", "-f", self.nixpkgs
, "--print-out-paths"
"nix",
"build",
"vimPlugins.nvim-treesitter.src",
"-f",
self.nixpkgs,
"--print-out-paths",
]
log.debug("Running command: %s", " ".join(cmd))
nvim_treesitter_dir = subprocess.check_output(cmd, text=True, timeout=90).strip()
nvim_treesitter_dir = subprocess.check_output(
cmd, text=True, timeout=90
).strip()
generated = treesitter.update_grammars(nvim_treesitter_dir)
treesitter_generated_nix_path = os.path.join(
NIXPKGS_NVIMTREESITTER_FOLDER,
"generated.nix"
NIXPKGS_NVIMTREESITTER_FOLDER, "generated.nix"
)
open(os.path.join(args.nixpkgs, treesitter_generated_nix_path), "w").write(
generated
)
open(os.path.join(args.nixpkgs, treesitter_generated_nix_path), "w").write(generated)
if self.nixpkgs_repo:
index = self.nixpkgs_repo.index

View File

@ -116,9 +116,10 @@ https://github.com/AndrewRadev/bufferize.vim/,HEAD,
https://github.com/akinsho/bufferline.nvim/,,
https://github.com/kwkarlwang/bufjump.nvim/,HEAD,
https://github.com/bullets-vim/bullets.vim/,,
https://github.com/mattn/calendar-vim/,,mattn-calendar-vim
https://github.com/itchyny/calendar.vim/,,
https://github.com/bkad/camelcasemotion/,,
https://github.com/catppuccin/nvim/,,catppuccin-nvim
https://github.com/catppuccin/vim/,HEAD,catppuccin-vim
https://github.com/tyru/caw.vim/,,
https://github.com/uga-rosa/ccc.nvim/,HEAD,
https://github.com/Eandrju/cellular-automaton.nvim/,HEAD,
@ -299,6 +300,7 @@ https://github.com/direnv/direnv.vim/,,
https://github.com/chipsenkbeil/distant.nvim/,HEAD,
https://github.com/doki-theme/doki-theme-vim/,,
https://github.com/NTBBloodbath/doom-one.nvim/,,
https://github.com/dracula/vim/,,dracula-vim
https://github.com/Mofiqul/dracula.nvim/,HEAD,
https://github.com/stevearc/dressing.nvim/,,
https://github.com/Bekaboo/dropbar.nvim/,HEAD,
@ -313,6 +315,7 @@ https://github.com/creativenull/efmls-configs-nvim/,,
https://github.com/elixir-tools/elixir-tools.nvim/,HEAD,
https://github.com/elmcast/elm-vim/,,
https://github.com/dmix/elvish.vim/,,
https://github.com/embark-theme/vim/,,embark-vim
https://github.com/mattn/emmet-vim/,,
https://github.com/vim-scripts/emodeline/,,
https://github.com/vim-scripts/errormarker.vim/,,
@ -361,6 +364,7 @@ https://github.com/gfanto/fzf-lsp.nvim/,,
https://github.com/ibhagwan/fzf-lua/,HEAD,
https://github.com/junegunn/fzf.vim/,,
https://github.com/NTBBloodbath/galaxyline.nvim/,,
https://github.com/gbprod/nord.nvim/,,gbprod-nord
https://github.com/jsfaint/gen_tags.vim/,,
https://github.com/gentoo/gentoo-syntax/,,
https://github.com/ndmitchell/ghcid/,,
@ -389,9 +393,9 @@ https://github.com/liuchengxu/graphviz.vim/,,
https://github.com/cbochs/grapple.nvim/,HEAD,
https://github.com/blazkowolf/gruber-darker.nvim/,,
https://github.com/MagicDuck/grug-far.nvim/,,
https://github.com/gruvbox-community/gruvbox/,,gruvbox-community
https://github.com/morhetz/gruvbox/,,
https://github.com/luisiacc/gruvbox-baby/,HEAD,
https://github.com/gruvbox-community/gruvbox/,,gruvbox-community
https://github.com/eddyekofo94/gruvbox-flat.nvim/,,
https://github.com/sainnhe/gruvbox-material/,,
https://github.com/f4z3r/gruvbox-material.nvim/,HEAD,
@ -404,8 +408,8 @@ https://github.com/junegunn/gv.vim/,,
https://github.com/TheSnakeWitcher/hardhat.nvim/,HEAD,
https://github.com/m4xshen/hardtime.nvim/,HEAD,
https://git.sr.ht/~sircmpwn/hare.vim,HEAD,
https://github.com/ThePrimeagen/harpoon/,harpoon2,harpoon2
https://github.com/ThePrimeagen/harpoon/,master,
https://github.com/ThePrimeagen/harpoon/,harpoon2,harpoon2
https://github.com/kiyoon/haskell-scope-highlighting.nvim/,HEAD,
https://github.com/mrcjkb/haskell-snippets.nvim/,HEAD,
https://github.com/neovimhaskell/haskell-vim/,,
@ -434,7 +438,6 @@ https://github.com/idris-hackers/idris-vim/,,
https://github.com/ShinKage/idris2-nvim/,,
https://github.com/edwinb/idris2-vim/,,
https://github.com/3rd/image.nvim/,HEAD,
https://github.com/samodostal/image.nvim/,HEAD,samodostal-image-nvim
https://github.com/HakonHarnes/img-clip.nvim/,HEAD,
https://github.com/lewis6991/impatient.nvim/,,
https://github.com/backdround/improved-search.nvim/,HEAD,
@ -447,7 +450,6 @@ https://github.com/Darazaki/indent-o-matic/,,
https://github.com/Yggdroot/indentLine/,,
https://github.com/ciaranm/inkpot/,,
https://github.com/jbyuki/instant.nvim/,HEAD,
https://github.com/jbyuki/one-small-step-for-vimkind/,HEAD,
https://github.com/pta2002/intellitab.nvim/,HEAD,
https://github.com/parsonsmatt/intero-neovim/,,
https://github.com/keith/investigate.vim/,,
@ -544,6 +546,7 @@ https://github.com/williamboman/mason.nvim/,HEAD,
https://github.com/vim-scripts/matchit.zip/,,
https://github.com/marko-cerovac/material.nvim/,,
https://github.com/kaicataldo/material.vim/,HEAD,
https://github.com/mattn/calendar-vim/,,mattn-calendar-vim
https://github.com/vim-scripts/mayansmoke/,,
https://github.com/chikamichi/mediawiki.vim/,HEAD,
https://github.com/savq/melange-nvim/,,
@ -602,7 +605,6 @@ https://github.com/miikanissi/modus-themes.nvim/,HEAD,
https://github.com/tomasr/molokai/,,
https://github.com/benlubas/molten-nvim/,HEAD,
https://github.com/loctvl842/monokai-pro.nvim/,HEAD,
https://github.com/shaunsingh/moonlight.nvim/,,pure-lua
https://github.com/leafo/moonscript-vim/,HEAD,
https://github.com/yegappan/mru/,,
https://github.com/smoka7/multicursors.nvim/,HEAD,
@ -673,7 +675,6 @@ https://github.com/stevanmilic/neotest-scala/,HEAD,
https://github.com/shunsambongi/neotest-testthat/,HEAD,
https://github.com/marilari88/neotest-vitest/,HEAD,
https://github.com/lawrence-laz/neotest-zig/,HEAD,
https://github.com/rose-pine/neovim/,main,rose-pine
https://github.com/Shatur/neovim-ayu/,,
https://github.com/cloudhead/neovim-fuzzy/,,
https://github.com/jeffkreeftmeijer/neovim-sensible/,,
@ -688,6 +689,7 @@ https://github.com/fiatjaf/neuron.vim/,,
https://github.com/Olical/nfnl/,main,
https://github.com/chr4/nginx.vim/,,
https://github.com/oxfist/night-owl.nvim/,,
https://github.com/bluz71/vim-nightfly-colors/,,nightfly
https://github.com/EdenEast/nightfox.nvim/,,
https://github.com/Alexis12119/nightly.nvim/,,
https://github.com/zah/nim.vim/,,
@ -699,7 +701,7 @@ https://github.com/shortcuts/no-neck-pain.nvim/,HEAD,
https://github.com/kartikp10/noctis.nvim/,,
https://github.com/folke/noice.nvim/,HEAD,
https://github.com/nvimtools/none-ls.nvim/,HEAD,
https://github.com/gbprod/nord.nvim/,,gbprod-nord
https://github.com/nordtheme/vim/,,nord-vim
https://github.com/shaunsingh/nord.nvim/,,
https://github.com/andersevenrud/nordic.nvim/,,
https://github.com/vigoux/notifier.nvim/,HEAD,
@ -708,8 +710,8 @@ https://github.com/MunifTanjim/nui.nvim/,main,
https://github.com/jose-elias-alvarez/null-ls.nvim/,,
https://github.com/nacro90/numb.nvim/,,
https://github.com/nvchad/nvchad/,HEAD,
https://github.com/nvchad/ui/,HEAD,nvchad-ui
https://github.com/ChristianChiarulli/nvcode-color-schemes.vim/,,
https://github.com/catppuccin/nvim/,,catppuccin-nvim
https://github.com/AckslD/nvim-FeMaco.lua/,HEAD,
https://github.com/nathanmsmith/nvim-ale-diagnostic/,,
https://github.com/windwp/nvim-autopairs/,,
@ -825,6 +827,7 @@ https://github.com/nomnivore/ollama.nvim/,HEAD,
https://github.com/yonlu/omni.vim/,,
https://github.com/Hoffs/omnisharp-extended-lsp.nvim/,HEAD,
https://github.com/Th3Whit3Wolf/one-nvim/,,
https://github.com/jbyuki/one-small-step-for-vimkind/,HEAD,
https://github.com/navarasu/onedark.nvim/,,
https://github.com/joshdick/onedark.vim/,,
https://github.com/LunarVim/onedarker.nvim/,,
@ -854,6 +857,7 @@ https://github.com/olimorris/persisted.nvim/,HEAD,
https://github.com/folke/persistence.nvim/,,
https://github.com/pest-parser/pest.vim/,HEAD,
https://github.com/lifepillar/pgsql.vim/,,
https://github.com/phha/zenburn.nvim/,,phha-zenburn
https://github.com/motus/pig.vim/,,
https://github.com/weirongxu/plantuml-previewer.vim/,HEAD,
https://github.com/aklt/plantuml-syntax/,,
@ -873,6 +877,7 @@ https://github.com/ahmedkhalf/project.nvim/,,
https://github.com/kevinhwang91/promise-async/,HEAD,
https://github.com/frigoeu/psc-ide-vim/,,
https://github.com/Shougo/pum.vim/,HEAD,
https://github.com/shaunsingh/moonlight.nvim/,,pure-lua
https://github.com/purescript-contrib/purescript-vim/,,
https://github.com/python-mode/python-mode/,,
https://github.com/vim-python/python-syntax/,,
@ -905,6 +910,7 @@ https://github.com/gu-fan/riv.vim/,,
https://github.com/kevinhwang91/rnvimr/,,
https://github.com/mfukar/robotframework-vim/,,
https://github.com/ron-rs/ron.vim/,,
https://github.com/rose-pine/neovim/,main,rose-pine
https://github.com/jmederosalvarado/roslyn.nvim/,HEAD,
https://github.com/keith/rspec.vim/,,
https://github.com/ccarpita/rtorrent-syntax-file/,,
@ -912,6 +918,7 @@ https://github.com/simrat39/rust-tools.nvim/,,
https://github.com/rust-lang/rust.vim/,,
https://github.com/hauleth/sad.vim/,,
https://github.com/vmware-archive/salt-vim/,,
https://github.com/samodostal/image.nvim/,HEAD,samodostal-image-nvim
https://github.com/lewis6991/satellite.nvim/,HEAD,
https://github.com/davidgranstrom/scnvim/,HEAD,
https://github.com/tiagovla/scope.nvim/,HEAD,
@ -935,8 +942,8 @@ https://github.com/mrjones2014/smart-splits.nvim/,,
https://github.com/m4xshen/smartcolumn.nvim/,,
https://github.com/gorkunov/smartpairs.vim/,,
https://github.com/ibhagwan/smartyank.nvim/,,
https://github.com/camspiers/snap/,,
https://github.com/folke/snacks.nvim/,HEAD,
https://github.com/camspiers/snap/,,
https://github.com/norcalli/snippets.nvim/,,
https://github.com/shaunsingh/solarized.nvim/,HEAD,
https://github.com/sainnhe/sonokai/,,
@ -1068,7 +1075,6 @@ https://github.com/jose-elias-alvarez/typescript.nvim/,,
https://github.com/MrPicklePinosaur/typst-conceal.vim/,HEAD,
https://github.com/chomosuke/typst-preview.nvim/,HEAD,
https://github.com/kaarmu/typst.vim/,HEAD,
https://github.com/nvchad/ui/,HEAD,nvchad-ui
https://github.com/altermo/ultimate-autopair.nvim/,HEAD,
https://github.com/SirVer/ultisnips/,,
https://github.com/mbbill/undotree/,,
@ -1084,11 +1090,6 @@ https://github.com/junegunn/vader.vim/,,
https://github.com/jbyuki/venn.nvim/,,
https://github.com/vhda/verilog_systemverilog.vim/,,
https://github.com/vifm/vifm.vim/,,
https://github.com/catppuccin/vim/,HEAD,catppuccin-vim
https://github.com/dracula/vim/,,dracula-vim
https://github.com/embark-theme/vim/,,embark-vim
https://github.com/nordtheme/vim/,,nord-vim
https://github.com/inkarkat/vim-AdvancedSorters/,,vim-advanced-sorters
https://github.com/Konfekt/vim-CtrlXA/,,
https://github.com/konfekt/vim-DetectSpellLang/,,
https://github.com/dpelle/vim-LanguageTool/,,
@ -1115,6 +1116,7 @@ https://github.com/MarcWeber/vim-addon-sql/,,
https://github.com/MarcWeber/vim-addon-syntax-checker/,,
https://github.com/MarcWeber/vim-addon-toggle-buffer/,,
https://github.com/MarcWeber/vim-addon-xdebug/,,
https://github.com/inkarkat/vim-AdvancedSorters/,,vim-advanced-sorters
https://github.com/junegunn/vim-after-object/,,
https://github.com/danilo-augusto/vim-afterglow/,HEAD,
https://github.com/msuperdock/vim-agda/,HEAD,
@ -1191,6 +1193,7 @@ https://github.com/kristijanhusak/vim-dirvish-git/,,
https://github.com/tpope/vim-dispatch/,,
https://github.com/radenling/vim-dispatch-neovim/,,
https://github.com/jhradilek/vim-docbk/,,
https://github.com/jhradilek/vim-snippets/,,vim-docbk-snippets
https://github.com/tpope/vim-dotenv/,,
https://github.com/junegunn/vim-easy-align/,,
https://github.com/zhou13/vim-easyescape/,,
@ -1344,7 +1347,6 @@ https://github.com/jistr/vim-nerdtree-tabs/,,
https://github.com/nfnty/vim-nftables/,,
https://github.com/kana/vim-niceblock/,,
https://github.com/nickel-lang/vim-nickel/,main,
https://github.com/bluz71/vim-nightfly-colors/,,nightfly
https://github.com/tommcdo/vim-ninja-feet/,,
https://github.com/LnL7/vim-nix/,,
https://github.com/symphorien/vim-nixhash/,,
@ -1436,7 +1438,6 @@ https://github.com/bohlender/vim-smt2/,,
https://github.com/justinmk/vim-sneak/,,
https://github.com/garbas/vim-snipmate/,,
https://github.com/honza/vim-snippets/,,
https://github.com/jhradilek/vim-snippets/,,vim-docbk-snippets
https://github.com/lifepillar/vim-solarized8/,HEAD,
https://github.com/tomlion/vim-solidity/,,
https://github.com/christoomey/vim-sort-motion/,,
@ -1565,7 +1566,6 @@ https://github.com/Lilja/zellij.nvim/,HEAD,
https://github.com/folke/zen-mode.nvim/,,
https://github.com/zenbones-theme/zenbones.nvim/,HEAD,
https://github.com/jnurmine/zenburn/,,
https://github.com/phha/zenburn.nvim/,,phha-zenburn
https://github.com/nvimdev/zephyr-nvim/,,
https://github.com/ziglang/zig.vim/,,
https://github.com/zk-org/zk-nvim/,HEAD,

View File

@ -1,26 +1,26 @@
#!/usr/bin/env python
# format:
# $ nix run nixpkgs#python3Packages.black -- update.py
# $ nix run nixpkgs#python3Packages.ruff -- update.py
# type-check:
# $ nix run nixpkgs#python3Packages.mypy -- update.py
# linted:
# $ nix run nixpkgs#python3Packages.flake8 -- --ignore E501,E265,E402 update.py
import inspect
import os
import tempfile
import shutil
from dataclasses import dataclass
import subprocess
import csv
import inspect
import logging
import os
import shutil
import subprocess
import tempfile
import textwrap
from dataclasses import dataclass
from multiprocessing.dummy import Pool
import pluginupdate
from pluginupdate import update_plugins, FetchConfig
from typing import List, Tuple, Optional
from pathlib import Path
from typing import List, Optional, Tuple
import pluginupdate
from pluginupdate import FetchConfig, update_plugins
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
@ -35,9 +35,7 @@ HEADER = """/* {GENERATED_NIXFILE} is an auto-generated file -- DO NOT EDIT!
Regenerate it with: nix run nixpkgs#luarocks-packages-updater
You can customize the generated packages in pkgs/development/lua-modules/overrides.nix
*/
""".format(
GENERATED_NIXFILE=GENERATED_NIXFILE
)
""".format(GENERATED_NIXFILE=GENERATED_NIXFILE)
FOOTER = """
}
@ -71,7 +69,6 @@ class LuaPlugin:
# rename Editor to LangUpdate/ EcosystemUpdater
class LuaEditor(pluginupdate.Editor):
def create_parser(self):
parser = super().create_parser()
parser.set_defaults(proc=1)
@ -173,10 +170,7 @@ def generate_pkg_nix(plug: LuaPlugin):
if plug.rockspec != "":
if plug.ref or plug.version:
msg = (
"'version' and 'ref' will be ignored as the rockspec is hardcoded for package %s"
% plug.name
)
msg = "'version' and 'ref' will be ignored as the rockspec is hardcoded for package %s" % plug.name
log.warning(msg)
log.debug("Updating from rockspec %s", plug.rockspec)
@ -193,7 +187,7 @@ def generate_pkg_nix(plug: LuaPlugin):
if plug.luaversion:
cmd.append(f"--lua-version={plug.luaversion}")
luaver = plug.luaversion.replace('.', '')
luaver = plug.luaversion.replace(".", "")
if luaver := os.getenv(f"LUA_{luaver}"):
cmd.append(f"--lua-dir={luaver}")