luarocks-packages-updater: silence some warnings

The script used to output:

```
Warning: Lua 5.1 interpreter not found at /nix/store/w577gc82dg7r1p480pp1kjbq7i32lhh2-lua-5.2.4
```
not sure why luarocks outputs since since it works nevertheless

added .flake8 so that the editor can pick it up too.
This commit is contained in:
Matthieu Coudron 2023-12-17 18:56:10 +01:00
parent 8855560298
commit 8e9d4495c7
3 changed files with 32 additions and 5 deletions

View file

@ -0,0 +1,6 @@
[flake8]
# E111 => 4 spaces tabs
# don't let spaces else it is not recognized
# E123 buggy
ignore =
E501,E265,E402

View file

@ -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"
'';

View file

@ -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))