python311Packages.supervise-api: refactor

This commit is contained in:
natsukium 2023-10-11 13:33:30 +09:00
parent 2d4aaaf76b
commit 3f232237fd
No known key found for this signature in database
GPG Key ID: 9EA45A31DB994C53
2 changed files with 19 additions and 30 deletions

View File

@ -3,39 +3,43 @@
, fetchPypi
, substituteAll
, supervise
, isPy3k
, whichcraft
, util-linux
, setuptools
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "supervise-api";
version = "0.6.0";
pyproject = true;
src = fetchPypi {
pname = "supervise_api";
inherit version;
sha256 = "1230f42294910e83421b7d3b08a968d27d510a4a709e966507ed70db5da1b9de";
hash = "sha256-EjD0IpSRDoNCG307CKlo0n1RCkpwnpZlB+1w212hud4=";
};
patches = [
(substituteAll {
src = ./supervise-path.patch;
inherit supervise;
})
postPatch = ''
substituteInPlace supervise_api/supervise.py \
--replace 'which("supervise")' '"${supervise}/bin/supervise"'
'';
nativeBuildInputs = [
setuptools
];
# In the git repo, supervise_api lives inside a python subdir
patchFlags = [ "-p2" ];
nativeCheckInputs = [
pytestCheckHook
];
propagatedBuildInputs = lib.optional (!isPy3k) whichcraft;
nativeCheckInputs = [ util-linux ];
pythonImportsCheck = [
"supervise_api"
];
meta = {
description = "An API for running processes safely and securely";
homepage = "https://github.com/catern/supervise";
license = lib.licenses.lgpl3;
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ catern ];
};
}

View File

@ -1,15 +0,0 @@
diff --git a/python/supervise_api/supervise.py b/python/supervise_api/supervise.py
index 497d3ea..be57e35 100644
--- a/python/supervise_api/supervise.py
+++ b/python/supervise_api/supervise.py
@@ -41,9 +41,7 @@ try:
except:
from whichcraft import which
-supervise_utility_location = which("supervise")
-if not supervise_utility_location:
- raise FileNotFoundError(errno.ENOENT, "Executable not found in PATH", "supervise")
+supervise_utility_location = '@supervise@/bin/supervise'
def ignore_sigchld():