@@ -1,10 +1,11 @@
11{ lib
22, buildPythonPackage
3−, pythonAtLeast
43, fetchFromGitHub
4+, fetchpatch
5+, mock
56, netaddr
67, pytestCheckHook
7−, mock
8+, pythonOlder
89}:
910
1011buildPythonPackage rec {
@@ -12,8 +13,7 @@ buildPythonPackage rec {
1213 version = "0.8.4";
1314 format = "pyproject";
1415
15− # https://github.com/arista-eosplus/pyeapi/issues/189
16− disabled = pythonAtLeast "3.10";
16+ disabled = pythonOlder "3.7";
1717
1818 src = fetchFromGitHub {
1919 owner = "arista-eosplus";
@@ -22,21 +22,44 @@ buildPythonPackage rec {
2222 sha256 = "13chya6wix5jb82k67gr44bjx35gcdwz80nsvpv0gvzs6shn4d7b";
2323 };
2424
25− propagatedBuildInputs = [ netaddr ];
25+ propagatedBuildInputs = [
26+ netaddr
27+ ];
2628
2729 checkInputs = [
2830 mock
2931 pytestCheckHook
3032 ];
3133
32− pytestFlagsArray = [ "test/unit" ];
34+ patches = [
35+ # Fix usage of collection, https://github.com/arista-eosplus/pyeapi/pull/223
36+ (fetchpatch {
37+ name = "fix-collection-usage.patch";
38+ url = "https://github.com/arista-eosplus/pyeapi/commit/81754f57eb095703cc474f527a0915360af76f68.patch";
39+ sha256 = "sha256-ZNBTPRNmXCFVJeRAJxzIHmCOXZiGwU6t4ekSupU3BX8=";
40+ })
41+ ];
42+
43+ postPatch = ''
44+ # https://github.com/arista-eosplus/pyeapi/pull/223
45+ substituteInPlace test/unit/test_utils.py \
46+ --replace "collections.Iterable" "collections.abc.Iterable"
47+ substituteInPlace pyeapi/api/abstract.py \
48+ --replace "from collections" "from collections.abc"
49+ '';
50+
51+ pytestFlagsArray = [
52+ "test/unit"
53+ ];
3354
34− pythonImportsCheck = [ "pyeapi" ];
55+ pythonImportsCheck = [
56+ "pyeapi"
57+ ];
3558
3659 meta = with lib; {
3760 description = "Client for Arista eAPI";
3861 homepage = "https://github.com/arista-eosplus/pyeapi";
3962 license = licenses.bsd3;
40− maintainers = [ maintainers.astro ];
63+ maintainers = with maintainers; [ astro ];
4164 };
4265}