2021-05-03 20:11:27 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
2018-10-15 17:51:43 +01:00
|
|
|
, cython
|
|
|
|
, eventlet
|
2021-03-24 16:45:56 +00:00
|
|
|
, futures ? null
|
2020-10-18 01:36:52 +01:00
|
|
|
, iana-etc
|
|
|
|
, geomet
|
2019-10-01 01:49:44 +01:00
|
|
|
, libev
|
2018-10-15 17:51:43 +01:00
|
|
|
, mock
|
|
|
|
, nose
|
2020-10-18 01:36:52 +01:00
|
|
|
, pytestCheckHook
|
2018-10-15 17:51:43 +01:00
|
|
|
, pytz
|
|
|
|
, pyyaml
|
2019-10-01 01:49:44 +01:00
|
|
|
, scales
|
|
|
|
, six
|
2018-10-15 17:51:43 +01:00
|
|
|
, sure
|
2020-10-18 01:36:52 +01:00
|
|
|
, gremlinpython
|
|
|
|
, gevent
|
|
|
|
, twisted
|
|
|
|
, libredirect
|
2018-10-15 17:51:43 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cassandra-driver";
|
2021-05-03 20:11:27 +01:00
|
|
|
version = "3.25.0";
|
2018-10-15 17:51:43 +01:00
|
|
|
|
2020-10-18 01:36:52 +01:00
|
|
|
# pypi tarball doesn't include tests
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "datastax";
|
|
|
|
repo = "python-driver";
|
|
|
|
rev = version;
|
2021-05-03 20:11:27 +01:00
|
|
|
sha256 = "1dn7iiavsrhh6i9hcyw0mk8j95r5ym0gbrvdca998hx2rnz5ark6";
|
2018-10-15 17:51:43 +01:00
|
|
|
};
|
|
|
|
|
2019-10-01 01:49:44 +01:00
|
|
|
nativeBuildInputs = [ cython ];
|
|
|
|
buildInputs = [ libev ];
|
2020-10-18 01:36:52 +01:00
|
|
|
propagatedBuildInputs = [ six geomet ]
|
2019-10-01 01:49:44 +01:00
|
|
|
++ lib.optionals (pythonOlder "3.4") [ futures ];
|
2018-10-15 17:51:43 +01:00
|
|
|
|
2020-10-18 01:36:52 +01:00
|
|
|
# Make /etc/protocols accessible to allow socket.getprotobyname('tcp') in sandbox,
|
|
|
|
# also /etc/resolv.conf is referenced by some tests
|
2021-01-31 21:43:23 +00:00
|
|
|
preCheck = (lib.optionalString stdenv.isLinux ''
|
2020-10-18 01:36:52 +01:00
|
|
|
echo "nameserver 127.0.0.1" > resolv.conf
|
|
|
|
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
|
|
|
|
export LD_PRELOAD=${libredirect}/lib/libredirect.so
|
|
|
|
'') + ''
|
|
|
|
# increase tolerance for time-based test
|
|
|
|
substituteInPlace tests/unit/io/utils.py --replace 'delta=.15' 'delta=.3'
|
|
|
|
'';
|
|
|
|
postCheck = ''
|
|
|
|
unset NIX_REDIRECTS LD_PRELOAD
|
2018-10-15 17:51:43 +01:00
|
|
|
'';
|
|
|
|
|
2020-10-18 01:36:52 +01:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
eventlet
|
|
|
|
mock
|
|
|
|
nose
|
|
|
|
pytz
|
|
|
|
pyyaml
|
|
|
|
sure
|
|
|
|
scales
|
|
|
|
gremlinpython
|
|
|
|
gevent
|
|
|
|
twisted
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"tests/unit"
|
2021-05-03 20:11:27 +01:00
|
|
|
];
|
|
|
|
disabledTestPaths = [
|
2020-10-18 01:36:52 +01:00
|
|
|
# requires puresasl
|
2021-05-03 20:11:27 +01:00
|
|
|
"tests/unit/advanced/test_auth.py"
|
2020-10-18 01:36:52 +01:00
|
|
|
];
|
|
|
|
disabledTests = [
|
|
|
|
# doesn't seem to be intended to be run directly
|
|
|
|
"_PoolTests"
|
|
|
|
# attempts to make connection to localhost
|
|
|
|
"test_connection_initialization"
|
|
|
|
];
|
|
|
|
|
2019-10-01 01:49:44 +01:00
|
|
|
meta = with lib; {
|
2018-10-15 17:51:43 +01:00
|
|
|
description = "A Python client driver for Apache Cassandra";
|
2019-10-01 01:49:44 +01:00
|
|
|
homepage = "http://datastax.github.io/python-driver";
|
2018-10-15 17:51:43 +01:00
|
|
|
license = licenses.asl20;
|
2020-10-18 01:36:52 +01:00
|
|
|
maintainers = with maintainers; [ turion ris ];
|
2018-10-15 17:51:43 +01:00
|
|
|
};
|
|
|
|
}
|