From eb8e68b41b69f335877ce560dae00e93068cd76e Mon Sep 17 00:00:00 2001 From: catern Date: Wed, 4 Jul 2018 07:54:00 -0400 Subject: [PATCH] pythonPackages.python-prctl: init at 1.7 (#42353) --- .../python-modules/python-prctl/default.nix | 26 ++++++++++++++ .../python-prctl/skip_bad_tests.patch | 34 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 3 files changed, 62 insertions(+) create mode 100644 pkgs/development/python-modules/python-prctl/default.nix create mode 100644 pkgs/development/python-modules/python-prctl/skip_bad_tests.patch diff --git a/pkgs/development/python-modules/python-prctl/default.nix b/pkgs/development/python-modules/python-prctl/default.nix new file mode 100644 index 00000000000..5d092f5e6ea --- /dev/null +++ b/pkgs/development/python-modules/python-prctl/default.nix @@ -0,0 +1,26 @@ +{ lib +, buildPythonPackage +, fetchPypi +, libcap +}: + +buildPythonPackage rec { + pname = "python-prctl"; + version = "1.7"; + + src = fetchPypi { + inherit pname version; + sha256 = "1njgixnavmwq45r3gpkhn1y760sax204clagg4gzwvvdc5bdbssp"; + }; + + patches = [ ./skip_bad_tests.patch ]; + buildInputs = [ libcap ]; + + meta = { + description = "Python(ic) interface to the linux prctl syscall"; + homepage = https://github.com/seveas/python-prctl; + license = lib.licenses.gpl3; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ catern ]; + }; +} diff --git a/pkgs/development/python-modules/python-prctl/skip_bad_tests.patch b/pkgs/development/python-modules/python-prctl/skip_bad_tests.patch new file mode 100644 index 00000000000..19d70f234a9 --- /dev/null +++ b/pkgs/development/python-modules/python-prctl/skip_bad_tests.patch @@ -0,0 +1,34 @@ +--- ./test_prctl.py 2018-01-26 16:02:52.000000000 -0500 ++++ ./test_prctl.py 2018-06-21 18:26:43.370065009 -0400 +@@ -154,6 +154,7 @@ + prctl.set_keepcaps(False) + self.assertEqual(prctl.get_keepcaps(), False) + ++ @unittest.skip("No access to /proc in the Nix build sandbox") + @require('set_mce_kill') + def test_mce_kill(self): + """Test the MCE_KILL setting""" +@@ -173,6 +174,7 @@ + prctl.set_name(name) + self.assertEqual(prctl.get_name(), name[:15]) + ++ @unittest.skip("The Nix build sandbox has no_new_privs already enabled") + @require('get_no_new_privs') + def test_no_new_privs(self): + """Test the no_new_privs function""" +@@ -189,6 +191,7 @@ + self.assertNotEqual(sp.returncode, 0) + os._exit(0) + ++ @unittest.skip("No access to /proc in the Nix build sandbox") + def test_proctitle(self): + """Test setting the process title, including too long titles""" + title = "This is a test!" +@@ -225,6 +228,7 @@ + os._exit(0) + self.assertRaises(OSError, prctl.set_ptracer, new_pid) + ++ @unittest.skip("The Nix build sandbox has seccomp already enabled") + @require('get_seccomp') + def test_seccomp(self): + """Test manipulation of the seccomp setting""" diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5f8530cbc0f..52ce93f8506 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -440,6 +440,8 @@ in { python-periphery = callPackage ../development/python-modules/python-periphery { }; + python-prctl = callPackage ../development/python-modules/python-prctl { }; + python-sql = callPackage ../development/python-modules/python-sql { }; python-stdnum = callPackage ../development/python-modules/python-stdnum { };