2020-10-18 01:36:52 +01:00
|
|
|
{ stdenv, lib, buildPythonPackage, fetchFromGitHub, python, pythonOlder
|
2018-10-15 17:51:43 +01:00
|
|
|
, cython
|
|
|
|
, eventlet
|
2019-10-01 01:49:44 +01:00
|
|
|
, futures
|
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";
|
2020-08-16 18:30:54 +01:00
|
|
|
version = "3.24.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;
|
|
|
|
sha256 = "1rr69hly5q810xpn8rkzxwzlq55wxxp7kwki9vfri3gh674d2wip";
|
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"
|
|
|
|
# requires puresasl
|
|
|
|
"--ignore=tests/unit/advanced/test_auth.py"
|
|
|
|
];
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|