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

backgroundremover: fix build, add update script, update to 0.2.8
This commit is contained in:
Weijia Wang 2024-05-12 19:45:14 +02:00 committed by GitHub
commit a07fc872d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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