Unverified Commit 57bbd52a authored by Matthieu Coudron's avatar Matthieu Coudron Committed by GitHub
Browse files

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
parent 824c6830
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+2 −2
Original line number Diff line number Diff line
@@ -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";
+24 −36
Original line number Diff line number Diff line
@@ -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 ];
  };
}

+19 −0
Original line number Diff line number Diff line
[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
Loading