From 6f3482f640b892e68c16bf8a59bffdbab2f5d4cd Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 7 Mar 2022 12:08:51 +0100 Subject: update.py: fix for kakoune/luarocks --- maintainers/scripts/update-luarocks-packages | 13 +++++-------- pkgs/applications/editors/kakoune/plugins/update.py | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/maintainers/scripts/update-luarocks-packages b/maintainers/scripts/update-luarocks-packages index c559d5699df..73a233c5f10 100755 --- a/maintainers/scripts/update-luarocks-packages +++ b/maintainers/scripts/update-luarocks-packages @@ -25,8 +25,8 @@ from pathlib import Path log = logging.getLogger() log.addHandler(logging.StreamHandler()) -ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))).parent.parent -from pluginupdate import Editor, update_plugins, PluginDesc, CleanEnvironment, LOG_LEVELS, Cache +ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))).parent.parent # type: ignore +from pluginupdate import Editor, update_plugins, FetchConfig, CleanEnvironment PKG_LIST="maintainers/scripts/luarocks-packages.csv" TMP_FILE="$(mktemp)" @@ -118,7 +118,7 @@ class LuaEditor(Editor): def attr_path(self): return "luaPackages" - def get_update(self, input_file: str, outfile: str, proc: int): + def get_update(self, input_file: str, outfile: str, config: FetchConfig): _prefetch = generate_pkg_nix def update() -> dict: @@ -126,14 +126,14 @@ class LuaEditor(Editor): sorted_plugin_specs = sorted(plugin_specs, key=lambda v: v.name.lower()) try: - pool = Pool(processes=proc) + pool = Pool(processes=config.proc) results = pool.map(_prefetch, sorted_plugin_specs) finally: pass self.generate_nix(results, outfile) - redirects = [] + redirects = {} return redirects return update @@ -181,11 +181,9 @@ def generate_pkg_nix(plug: LuaPlugin): cmd.append(plug.version) - # if plug.server != "src" and plug.server: cmd.append(f"--only-server={plug.server}") - if plug.luaversion: with CleanEnvironment(): local_pkgs = str(ROOT.resolve()) @@ -209,7 +207,6 @@ def main(): parser = editor.create_parser() args = parser.parse_args() - log.setLevel(LOG_LEVELS[args.debug]) update_plugins(editor, args) diff --git a/pkgs/applications/editors/kakoune/plugins/update.py b/pkgs/applications/editors/kakoune/plugins/update.py index 9f5f64f9e5b..dd8765db28a 100755 --- a/pkgs/applications/editors/kakoune/plugins/update.py +++ b/pkgs/applications/editors/kakoune/plugins/update.py @@ -15,7 +15,7 @@ from typing import List, Tuple from pathlib import Path # Import plugin update library from maintainers/scripts/pluginupdate.py -ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) +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") ) @@ -42,7 +42,7 @@ HEADER = "# This file has been generated by ./pkgs/applications/editors/kakoune/ class KakouneEditor(pluginupdate.Editor): - def generate_nix(plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: str): + def generate_nix(self, 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: -- cgit 1.4.1