From 2bddfc7cd326eae64fc1dfb954ae151b7db15860 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 2 May 2022 12:07:27 +0200 Subject: [PATCH 1/2] python39Packages.pyeapi: fix Python 3.10 support --- .../python-modules/pyeapi/default.nix | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/pyeapi/default.nix b/pkgs/development/python-modules/pyeapi/default.nix index a31123492d42..e856a33da02c 100644 --- a/pkgs/development/python-modules/pyeapi/default.nix +++ b/pkgs/development/python-modules/pyeapi/default.nix @@ -1,10 +1,11 @@ { lib , buildPythonPackage -, pythonAtLeast , fetchFromGitHub +, fetchpatch +, mock , netaddr , pytestCheckHook -, mock +, pythonOlder }: buildPythonPackage rec { @@ -12,8 +13,7 @@ buildPythonPackage rec { version = "0.8.4"; format = "pyproject"; - # https://github.com/arista-eosplus/pyeapi/issues/189 - disabled = pythonAtLeast "3.10"; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "arista-eosplus"; @@ -22,21 +22,44 @@ buildPythonPackage rec { sha256 = "13chya6wix5jb82k67gr44bjx35gcdwz80nsvpv0gvzs6shn4d7b"; }; - propagatedBuildInputs = [ netaddr ]; + propagatedBuildInputs = [ + netaddr + ]; checkInputs = [ mock pytestCheckHook ]; - pytestFlagsArray = [ "test/unit" ]; + patches = [ + # Fix usage of collection, https://github.com/arista-eosplus/pyeapi/pull/223 + (fetchpatch { + name = "fix-collection-usage.patch"; + url = "https://github.com/arista-eosplus/pyeapi/commit/81754f57eb095703cc474f527a0915360af76f68.patch"; + sha256 = "sha256-ZNBTPRNmXCFVJeRAJxzIHmCOXZiGwU6t4ekSupU3BX8="; + }) + ]; - pythonImportsCheck = [ "pyeapi" ]; + postPatch = '' + # https://github.com/arista-eosplus/pyeapi/pull/223 + substituteInPlace test/unit/test_utils.py \ + --replace "collections.Iterable" "collections.abc.Iterable" + substituteInPlace pyeapi/api/abstract.py \ + --replace "from collections" "from collections.abc" + ''; + + pytestFlagsArray = [ + "test/unit" + ]; + + pythonImportsCheck = [ + "pyeapi" + ]; meta = with lib; { description = "Client for Arista eAPI"; homepage = "https://github.com/arista-eosplus/pyeapi"; license = licenses.bsd3; - maintainers = [ maintainers.astro ]; + maintainers = with maintainers; [ astro ]; }; } From ebaa5279daf393a44b81b74be8a667af12f830ff Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 3 May 2022 11:35:14 +0200 Subject: [PATCH 2/2] python310Packages.pyeapi: fix Python 3.10 support --- .../python-modules/pyeapi/default.nix | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/pyeapi/default.nix b/pkgs/development/python-modules/pyeapi/default.nix index e856a33da02c..aa9e0983b7e3 100644 --- a/pkgs/development/python-modules/pyeapi/default.nix +++ b/pkgs/development/python-modules/pyeapi/default.nix @@ -38,16 +38,21 @@ buildPythonPackage rec { url = "https://github.com/arista-eosplus/pyeapi/commit/81754f57eb095703cc474f527a0915360af76f68.patch"; sha256 = "sha256-ZNBTPRNmXCFVJeRAJxzIHmCOXZiGwU6t4ekSupU3BX8="; }) + (fetchpatch { + name = "fix-collection-usage-2.patch"; + url = "https://github.com/arista-eosplus/pyeapi/commit/cc9c584e4a3167e3c1624cccb6bc0d9c9bcdbc1c.patch"; + sha256 = "sha256-EY0i1Skm1llEQAAzvrb2yelhhLBkqKAFJB5ObAIxAYo="; + excludes = [ + ".github/workflows/ci.yml" + ]; + }) + (fetchpatch { + name = "fix-collection-usage-3.patch"; + url = "https://github.com/arista-eosplus/pyeapi/commit/dc35ab076687ea71665ae9524480b05a4e893909.patch"; + sha256 = "sha256-xPaYULCPTxiQGB9Im/qLet+XebW9wq+TAfrxcgQxcoE="; + }) ]; - postPatch = '' - # https://github.com/arista-eosplus/pyeapi/pull/223 - substituteInPlace test/unit/test_utils.py \ - --replace "collections.Iterable" "collections.abc.Iterable" - substituteInPlace pyeapi/api/abstract.py \ - --replace "from collections" "from collections.abc" - ''; - pytestFlagsArray = [ "test/unit" ];