1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 libcap,
6 pytestCheckHook,
7 distutils,
8}:
9
10buildPythonPackage rec {
11 pname = "python-prctl";
12 version = "1.8.1";
13 format = "setuptools";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "b4ca9a25a7d4f1ace4fffd1f3a2e64ef5208fe05f929f3edd5e27081ca7e67ce";
18 };
19
20 buildInputs = [ libcap ];
21
22 nativeCheckInputs = [
23 distutils
24 pytestCheckHook
25 ];
26
27 postPatch = ''
28 substituteInPlace test_prctl.py \
29 --replace-fail \
30 'sys.version[0:3]' \
31 '"cpython-%d%d" % (sys.version_info.major, sys.version_info.minor)'
32 '';
33
34 disabledTests = [
35 # Intel MPX support was removed in GCC 9.1 & Linux kernel 5.6
36 "test_mpx"
37
38 # The Nix build sandbox has no_new_privs already enabled
39 "test_no_new_privs"
40
41 # The Nix build sandbox has seccomp already enabled
42 "test_seccomp"
43
44 # This will fail if prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_FORCE_DISABLE)
45 # has been set system-wide, even outside the sandbox
46 "test_speculation_ctrl"
47 ];
48
49 meta = {
50 description = "Python(ic) interface to the linux prctl syscall";
51 homepage = "https://github.com/seveas/python-prctl";
52 license = lib.licenses.gpl3;
53 platforms = lib.platforms.linux;
54 maintainers = with lib.maintainers; [ catern ];
55 };
56}