From 6ac337aa06d044cf0a6a8caebb232223d22b402b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 3 May 2022 11:51:12 +0200 Subject: [PATCH] python310Packages.namedlist: add patch for collections.abc --- .../python-modules/namedlist/default.nix | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/namedlist/default.nix b/pkgs/development/python-modules/namedlist/default.nix index 874b1e177d27..d9b2db64f465 100644 --- a/pkgs/development/python-modules/namedlist/default.nix +++ b/pkgs/development/python-modules/namedlist/default.nix @@ -1,33 +1,54 @@ { lib , buildPythonPackage , fetchPypi -, pytest +, fetchpatch +, pytestCheckHook +, pythonOlder }: buildPythonPackage rec { pname = "namedlist"; version = "1.8"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; - sha256 = "34f89fc992592c80b39a709e136edcf41ea17f24ba31eaf84a314a02c8b9bcef"; + hash = "sha256-NPifyZJZLICzmnCeE27c9B6hfyS6Mer4SjFKAsi5vO8="; }; + checkInputs = [ + pytestCheckHook + ]; + + patches = [ + # Deprecation warning using collections.abc, https://gitlab.com/ericvsmith/namedlist/-/merge_requests/1 + (fetchpatch { + url = "https://gitlab.com/ericvsmith/namedlist/-/commit/102d15b455e6f058b9c95fe135167be82b34c14a.patch"; + sha256 = "sha256-IfDgiObFFSOUnAlXR/+ye8uutGaFJ/AyQvCb76iNaMM="; + }) + ]; + # Test file has a `unittest.main()` at the bottom that fails the tests; # py.test can run the tests without it. postPatch = '' substituteInPlace test/test_namedlist.py --replace "unittest.main()" "" ''; - checkInputs = [ pytest ]; - checkPhase = '' - py.test - ''; + pythonImportsCheck = [ + "namedlist" + ]; - meta = { + disabledTests = [ + # AttributeError: module 'collections' has no attribute 'Container' + "test_ABC" + ]; + + meta = with lib; { description = "Similar to namedtuple, but instances are mutable"; homepage = "https://gitlab.com/ericvsmith/namedlist"; - license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ ivan ]; + license = licenses.asl20; + maintainers = with maintainers; [ ivan ]; }; }