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 # wrap python scripts
makeWrapperArgs+=( --prefix PATH : "${lib.makeBinPath [ 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 wrapPythonPrograms
''; '';
shellHook = '' 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"; meta.mainProgram = "vim-plugins-updater";

View File

@ -4,10 +4,6 @@
, lib , lib
, nix-prefetch-scripts , nix-prefetch-scripts
, luarocks-nix , luarocks-nix
, lua5_1
, lua5_2
, lua5_3
, lua5_4
, pluginupdate , pluginupdate
}: }:
let let
@ -16,52 +12,44 @@ let
nix nix-prefetch-scripts luarocks-nix nix nix-prefetch-scripts luarocks-nix
]; ];
luaversions = [ attrs = builtins.fromTOML (builtins.readFile ./pyproject.toml);
lua5_1 pname = attrs.project.name;
lua5_2 inherit (attrs.project) version;
lua5_3
lua5_4
];
in in
python3Packages.buildPythonApplication { python3Packages.buildPythonApplication {
pname = "luarocks-packages-updater"; inherit pname version;
version = "0.1"; pyproject = true;
format = "other"; src = lib.cleanSource ./.;
nativeBuildInputs = [ build-system = [
makeWrapper python3Packages.setuptools
python3Packages.wrapPython
]; ];
propagatedBuildInputs = [
dependencies = [
python3Packages.gitpython python3Packages.gitpython
]; ];
dontUnpack = true; postFixup = ''
echo "pluginupdate folder ${pluginupdate}"
installPhase = wrapProgram $out/bin/luarocks-packages-updater \
'' --prefix PYTHONPATH : "${pluginupdate}" \
mkdir -p $out/bin $out/lib --prefix PATH : "${path}"
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"
''; '';
shellHook = '' shellHook = ''
export PYTHONPATH="maintainers/scripts:$PYTHONPATH" export PYTHONPATH="maintainers/scripts/pluginupdate-py:$PYTHONPATH"
export PATH="${path}:$PATH" 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: str
"""Name of the plugin, as seen on luarocks.org""" """Name of the plugin, as seen on luarocks.org"""
rockspec: str rockspec: str
"""Full path towards the rockspec""" """Full URI towards the rockspec"""
ref: Optional[str] ref: Optional[str]
"""git reference (branch name/tag)""" """git reference (branch name/tag)"""
version: Optional[str] version: Optional[str]
@ -60,7 +60,7 @@ class LuaPlugin:
Its value can be 'http://luarocks.org/dev' Its value can be 'http://luarocks.org/dev'
""" """
luaversion: Optional[str] 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] maintainers: Optional[str]
""" Optional string listing maintainers separated by spaces""" """ Optional string listing maintainers separated by spaces"""

View File

@ -16431,7 +16431,7 @@ with pkgs;
luarocks-nix = luaPackages.luarocks-nix; luarocks-nix = luaPackages.luarocks-nix;
luarocks-packages-updater = callPackage ../by-name/lu/luarocks-packages-updater/package.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 { }; luau = callPackage ../development/interpreters/luau { };