python3Packages.pyrad: fix build failing

- Failing on ZHF https://hydra.nixos.org/build/258464455
- Fix netaddr to use the correct version
- Fix use of deleted methods in python312 causing build fail
This commit is contained in:
Clément 2024-05-08 21:29:00 +02:00
parent c459868572
commit 7e2cf7d352
No known key found for this signature in database
GPG key ID: CFAE6BC61FF97205

View file

@ -6,7 +6,19 @@
, netaddr
, six
, unittestCheckHook
, fetchPypi
}:
let
netaddr_0_8_0 = netaddr.overridePythonAttrs (oldAttrs: rec {
version = "0.8.0";
src = fetchPypi {
pname = "netaddr";
inherit version;
hash = "sha256-1sxXx6B7HZ0ukXqos2rozmHDW6P80bg8oxxaDuK1okM=";
};
});
in
buildPythonPackage rec {
pname = "pyrad";
@ -33,14 +45,21 @@ buildPythonPackage rec {
];
propagatedBuildInputs = [
netaddr
netaddr_0_8_0
six
];
preCheck = ''
substituteInPlace tests/testServer.py \
--replace "def testBind(self):" "def dontTestBind(self):" \
--replace "def testBindv6(self):" "def dontTestBindv6(self):"
--replace-warn "def testBind(self):" "def dontTestBind(self):" \
--replace-warn "def testBindv6(self):" "def dontTestBindv6(self):" \
# A lot of test methods have been deprecated since Python 3.1
# and have been removed in Python 3.12.
# https://docs.python.org/3/whatsnew/3.11.html#pending-removal-in-python-3-12
substituteInPlace tests/*.py \
--replace-quiet "self.failUnless" "self.assertTrue" \
--replace-quiet "self.failIf" "self.assertFalse" \
--replace-quiet "self.assertEquals" "self.assertEqual"
'';
nativeCheckInputs = [