2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
cryptography,
|
|
|
|
cython_0,
|
|
|
|
eventlet,
|
|
|
|
fetchFromGitHub,
|
|
|
|
geomet,
|
|
|
|
gevent,
|
|
|
|
gremlinpython,
|
|
|
|
iana-etc,
|
|
|
|
libev,
|
|
|
|
libredirect,
|
|
|
|
mock,
|
|
|
|
nose,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pytz,
|
|
|
|
pyyaml,
|
|
|
|
scales,
|
|
|
|
six,
|
|
|
|
sure,
|
|
|
|
twisted,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cassandra-driver";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "3.29.1";
|
2023-04-12 12:48:02 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "datastax";
|
|
|
|
repo = "python-driver";
|
2023-04-12 12:48:02 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-pnNm5Pd5k4bt+s3GrUUDWRpSdqNSM89GiX8DZKYzW1E=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
postPatch = ''
|
2023-04-12 12:48:02 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace 'geomet>=0.1,<0.3' 'geomet'
|
2021-08-22 07:53:02 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ cython_0 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ libev ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
six
|
|
|
|
geomet
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pytestCheckHook
|
|
|
|
mock
|
|
|
|
nose
|
|
|
|
pytz
|
|
|
|
pyyaml
|
|
|
|
sure
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
# Make /etc/protocols accessible to allow socket.getprotobyname('tcp') in sandbox,
|
|
|
|
# also /etc/resolv.conf is referenced by some tests
|
2024-06-05 15:53:02 +00:00
|
|
|
preCheck =
|
|
|
|
(lib.optionalString stdenv.isLinux ''
|
|
|
|
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'
|
|
|
|
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
# cythonize this before we hide the source dir as it references
|
|
|
|
# one of its files
|
|
|
|
cythonize -i tests/unit/cython/types_testhelper.pyx
|
|
|
|
|
|
|
|
mv cassandra .cassandra.hidden
|
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "cassandra" ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
postCheck = ''
|
|
|
|
unset NIX_REDIRECTS LD_PRELOAD
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "tests/unit" ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
disabledTestPaths = [
|
2021-02-05 17:12:51 +00:00
|
|
|
# requires puresasl
|
2021-05-20 23:08:51 +00:00
|
|
|
"tests/unit/advanced/test_auth.py"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
disabledTests = [
|
|
|
|
# doesn't seem to be intended to be run directly
|
|
|
|
"_PoolTests"
|
|
|
|
# attempts to make connection to localhost
|
|
|
|
"test_connection_initialization"
|
2021-08-22 07:53:02 +00:00
|
|
|
# time-sensitive
|
|
|
|
"test_nts_token_performance"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
cle = [ cryptography ];
|
|
|
|
eventlet = [ eventlet ];
|
|
|
|
gevent = [ gevent ];
|
|
|
|
graph = [ gremlinpython ];
|
|
|
|
metrics = [ scales ];
|
|
|
|
twisted = [ twisted ];
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Python client driver for Apache Cassandra";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://datastax.github.io/python-driver";
|
2023-04-12 12:48:02 +00:00
|
|
|
changelog = "https://github.com/datastax/python-driver/blob/${version}/CHANGELOG.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2023-08-22 20:05:09 +00:00
|
|
|
maintainers = with maintainers; [ ris ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|