summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2022-05-02 12:07:27 +0200
committerFabian Affolter <mail@fabian-affolter.ch>2022-05-02 12:07:27 +0200
commit2bddfc7cd326eae64fc1dfb954ae151b7db15860 (patch)
treee6c0626f9c28fef75b131f289b91b5c055b3c554 /pkgs/development/python-modules
parent887cf48b06ae81492475dc2e54eb5258270379a4 (diff)
python39Packages.pyeapi: fix Python 3.10 support
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/pyeapi/default.nix39
1 files 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=";
+ })
+ ];
+
+ 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" ];
+ 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 ];
};
}