packages luarocks updater as pyproject package (#343584)

* luarocks-packages-updater: convert into pyproject package

* pluginupdate: move to its own folder

so we can copy just the folder when using this as a module

* luarocks-packages-updater: adress review
This commit is contained in:
Matthieu Coudron 2024-09-22 21:15:41 +02:00 committed by GitHub
parent 824c683094
commit 57bbd52af5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 48 additions and 41 deletions

View File

@ -33,12 +33,12 @@ buildPythonApplication {
# wrap python scripts
makeWrapperArgs+=( --prefix PATH : "${lib.makeBinPath [
nix nix-prefetch-git neovim-unwrapped nurl ]}" --prefix PYTHONPATH : "${./.}:${../../../../../maintainers/scripts}" )
nix nix-prefetch-git neovim-unwrapped nurl ]}" --prefix PYTHONPATH : "${./.}:${../../../../../maintainers/scripts/pluginupdate-py}" )
wrapPythonPrograms
'';
shellHook = ''
export PYTHONPATH=pkgs/applications/editors/vim/plugins:maintainers/scripts:$PYTHONPATH
export PYTHONPATH=pkgs/applications/editors/vim/plugins:maintainers/scripts/pluginupdate-py:$PYTHONPATH
'';
meta.mainProgram = "vim-plugins-updater";

View File

@ -4,10 +4,6 @@
, lib
, nix-prefetch-scripts
, luarocks-nix
, lua5_1
, lua5_2
, lua5_3
, lua5_4
, pluginupdate
}:
let
@ -16,52 +12,44 @@ let
nix nix-prefetch-scripts luarocks-nix
];
luaversions = [
lua5_1
lua5_2
lua5_3
lua5_4
];
attrs = builtins.fromTOML (builtins.readFile ./pyproject.toml);
pname = attrs.project.name;
inherit (attrs.project) version;
in
python3Packages.buildPythonApplication {
pname = "luarocks-packages-updater";
version = "0.1";
inherit pname version;
pyproject = true;
format = "other";
src = lib.cleanSource ./.;
nativeBuildInputs = [
makeWrapper
python3Packages.wrapPython
build-system = [
python3Packages.setuptools
];
propagatedBuildInputs = [
dependencies = [
python3Packages.gitpython
];
dontUnpack = true;
installPhase =
''
mkdir -p $out/bin $out/lib
cp ${./updater.py} $out/bin/luarocks-packages-updater
cp ${pluginupdate} $out/lib/pluginupdate.py
# wrap python scripts
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"
postFixup = ''
echo "pluginupdate folder ${pluginupdate}"
wrapProgram $out/bin/luarocks-packages-updater \
--prefix PYTHONPATH : "${pluginupdate}" \
--prefix PATH : "${path}"
'';
shellHook = ''
export PYTHONPATH="maintainers/scripts:$PYTHONPATH"
export PYTHONPATH="maintainers/scripts/pluginupdate-py:$PYTHONPATH"
export PATH="${path}:$PATH"
'';
meta.mainProgram = "luarocks-packages-updater";
meta = {
inherit (attrs.project) description;
license = lib.licenses.gpl3Only;
homepage = attrs.project.urls.Homepage;
mainProgram = "luarocks-packages-updater";
maintainers = with lib.maintainers; [ teto ];
};
}

View File

@ -0,0 +1,19 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [ "setuptools" ]
[project]
name = "luarocks-packages-updater"
version = "0.0.1"
description = """
Module to update luarocks-packages"""
[project.urls]
Homepage = "https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name/lu/luarocks-packages-updater"
[project.scripts]
luarocks-packages-updater = "updater:main"
[tool.ruff]
line-length = 120
indent-width = 4

View File

@ -50,7 +50,7 @@ class LuaPlugin:
name: str
"""Name of the plugin, as seen on luarocks.org"""
rockspec: str
"""Full path towards the rockspec"""
"""Full URI towards the rockspec"""
ref: Optional[str]
"""git reference (branch name/tag)"""
version: Optional[str]
@ -60,7 +60,7 @@ class LuaPlugin:
Its value can be 'http://luarocks.org/dev'
"""
luaversion: Optional[str]
"""Attribue of the lua interpreter if a package is available only for a specific lua version"""
"""lua version if a package is available only for a specific lua version"""
maintainers: Optional[str]
""" Optional string listing maintainers separated by spaces"""

View File

@ -16431,7 +16431,7 @@ with pkgs;
luarocks-nix = luaPackages.luarocks-nix;
luarocks-packages-updater = callPackage ../by-name/lu/luarocks-packages-updater/package.nix {
pluginupdate = ../../maintainers/scripts/pluginupdate.py;
pluginupdate = ../../maintainers/scripts/pluginupdate-py;
};
luau = callPackage ../development/interpreters/luau { };