Unverified Commit a07fc872 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #310927 from lucasew/20240511-fix-backgroundremover

backgroundremover: fix build, add update script, update to 0.2.8
parents 6e42ddf7 c6fe69b3
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -3,20 +3,21 @@
, runCommand
, fetchFromGitHub
, fetchurl
, gitUpdater
}:

let
  p = python3.pkgs;
  self = p.buildPythonApplication rec {
    pname = "backgroundremover";
    version = "0.2.6";
    version = "0.2.8";
    pyproject = true;

    src = fetchFromGitHub {
      owner = "nadermx";
      repo = "backgroundremover";
      rev = "v${version}";
      hash = "sha256-dDOo7NPwvdfV+ae2oMUytCGC+2HF6xUI7dyKk2we23w=";
      hash = "sha256-LjVT4j0OzfbVSQgU0z/gzRTLm7N0RQRrfxtTugWwOxs=";
    };

    models = runCommand "background-remover-models" {} ''
@@ -31,7 +32,9 @@ let
        --replace 'os.path.expanduser(os.path.join("~", ".u2net", model_name + ".pth"))' "os.path.join(\"$models\", model_name + \".pth\")"
    '';

    nativeBuildInputs = [ p.setuptools p.wheel ];
    nativeBuildInputs = [ p.setuptools p.wheel p.pythonRelaxDepsHook ];

    pythonRelaxDeps = [ "pillow" "torchvision" ];

    propagatedBuildInputs = [
      p.certifi
@@ -76,6 +79,7 @@ let
          backgroundremover -i ${demoImage} -o $out
        '';
      };
      updateScript = gitUpdater { rev-prefix = "v"; };
    };

    doCheck = false; # no tests