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