diff --git a/pkgs/development/lua-modules/updater/.flake8 b/pkgs/development/lua-modules/updater/.flake8 new file mode 100644 index 000000000000..16f76a43624c --- /dev/null +++ b/pkgs/development/lua-modules/updater/.flake8 @@ -0,0 +1,6 @@ +[flake8] +# E111 => 4 spaces tabs +# don't let spaces else it is not recognized +# E123 buggy +ignore = + E501,E265,E402 diff --git a/pkgs/development/lua-modules/updater/default.nix b/pkgs/development/lua-modules/updater/default.nix index 40c93b21e831..e556d4d0dec9 100644 --- a/pkgs/development/lua-modules/updater/default.nix +++ b/pkgs/development/lua-modules/updater/default.nix @@ -6,10 +6,24 @@ # , nix-prefetch-git , nix-prefetch-scripts , luarocks-nix +, lua5_1 +, lua5_2 +, lua5_3 +, lua5_4 }: let - path = lib.makeBinPath [ nix nix-prefetch-scripts luarocks-nix ]; + path = lib.makeBinPath [ + nix nix-prefetch-scripts luarocks-nix + ]; + + luaversions = [ + lua5_1 + lua5_2 + lua5_3 + lua5_4 + ]; + in buildPythonApplication { pname = "luarocks-packages-updater"; @@ -34,7 +48,12 @@ buildPythonApplication { cp ${../../../../maintainers/scripts/pluginupdate.py} $out/lib/pluginupdate.py # wrap python scripts - makeWrapperArgs+=( --prefix PATH : "${path}" --prefix PYTHONPATH : "$out/lib" ) + makeWrapperArgs+=( --prefix PATH : "${path}" --prefix PYTHONPATH : "$out/lib" \ + --set LUA_51 ${lua5_1} \ + --set LUA_52 ${lua5_2} \ + --set LUA_53 ${lua5_3} \ + --set LUA_54 ${lua5_4} + ) wrapPythonProgramsIn "$out" ''; diff --git a/pkgs/development/lua-modules/updater/updater.py b/pkgs/development/lua-modules/updater/updater.py index 89a9bd9823a7..3f1d27ab129f 100755 --- a/pkgs/development/lua-modules/updater/updater.py +++ b/pkgs/development/lua-modules/updater/updater.py @@ -16,6 +16,8 @@ import csv import logging import textwrap from multiprocessing.dummy import Pool +import pluginupdate +from pluginupdate import update_plugins, FetchConfig from typing import List, Tuple, Optional from pathlib import Path @@ -24,8 +26,6 @@ log = logging.getLogger() log.addHandler(logging.StreamHandler()) ROOT = Path(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))).parent.parent # type: ignore -import pluginupdate -from pluginupdate import update_plugins, FetchConfig, CleanEnvironment PKG_LIST = "maintainers/scripts/luarocks-packages.csv" TMP_FILE = "$(mktemp)" @@ -171,7 +171,6 @@ def generate_pkg_nix(plug: LuaPlugin): if plug.maintainers: cmd.append(f"--maintainers={plug.maintainers}") - # if plug.server == "src": if plug.src != "": if plug.src is None: msg = ( @@ -193,6 +192,9 @@ def generate_pkg_nix(plug: LuaPlugin): if plug.luaversion: cmd.append(f"--lua-version={plug.luaversion}") + luaver = plug.luaversion.replace('.', '') + if luaver := os.getenv(f"LUA_{luaver}"): + cmd.append(f"--lua-dir={luaver}") log.debug("running %s", " ".join(cmd))