2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
cryptography,
|
2024-09-19 14:19:46 +00:00
|
|
|
cython,
|
2024-06-05 15:53:02 +00:00
|
|
|
eventlet,
|
|
|
|
fetchFromGitHub,
|
2024-09-19 14:19:46 +00:00
|
|
|
fetchpatch2,
|
2024-06-05 15:53:02 +00:00
|
|
|
geomet,
|
|
|
|
gevent,
|
|
|
|
gremlinpython,
|
|
|
|
iana-etc,
|
|
|
|
libev,
|
|
|
|
libredirect,
|
|
|
|
pytestCheckHook,
|
|
|
|
pytz,
|
|
|
|
pyyaml,
|
|
|
|
scales,
|
|
|
|
six,
|
|
|
|
sure,
|
|
|
|
twisted,
|
2024-09-19 14:19:46 +00:00
|
|
|
setuptools,
|
|
|
|
distutils,
|
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";
|
2024-09-19 14:19:46 +00:00
|
|
|
pyproject = true;
|
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
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/datastax/python-driver/pull/1201
|
|
|
|
# Also needed for below patch to apply
|
|
|
|
(fetchpatch2 {
|
|
|
|
name = "remove-mock-dependency.patch";
|
|
|
|
url = "https://github.com/datastax/python-driver/commit/9aca00be33d96559f0eabc1c8a26bb439dcebbd7.patch";
|
|
|
|
hash = "sha256-ZN95V8ebbjahzqBat2oKBJLfu0fqbWMvAu0DzfVGw8I=";
|
|
|
|
})
|
|
|
|
# https://github.com/datastax/python-driver/pull/1215
|
|
|
|
(fetchpatch2 {
|
|
|
|
name = "convert-to-pytest.patch";
|
|
|
|
url = "https://github.com/datastax/python-driver/commit/9952e2ab22c7e034b96cc89330791d73c221546b.patch";
|
|
|
|
hash = "sha256-xa2aV6drBcgkQT05kt44vwupg3oMHLbcbZSQ7EHKnko=";
|
|
|
|
})
|
|
|
|
# https://github.com/datastax/python-driver/pull/1195
|
|
|
|
(fetchpatch2 {
|
|
|
|
name = "remove-assertRaisesRegexp.patch";
|
|
|
|
url = "https://github.com/datastax/python-driver/commit/622523b83971e8a181eb4853b7d877420c0351ef.patch";
|
|
|
|
hash = "sha256-Q8pRhHBLKyenMfrITf8kDv3BbsSCDAmVisTr4jSAIvA=";
|
|
|
|
})
|
|
|
|
];
|
2021-08-22 07:53:02 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
pythonRelaxDeps = [ "geomet" ];
|
|
|
|
|
|
|
|
build-system = [
|
|
|
|
distutils
|
|
|
|
setuptools
|
|
|
|
cython
|
|
|
|
];
|
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
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = [
|
2023-04-12 12:48:02 +00:00
|
|
|
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
|
|
|
|
pytz
|
|
|
|
pyyaml
|
|
|
|
sure
|
2024-10-04 16:56:33 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues optional-dependencies);
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
# This is used to determine the version of cython that can be used
|
|
|
|
CASS_DRIVER_ALLOWED_CYTHON_VERSION = cython.version;
|
|
|
|
|
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 =
|
2024-09-26 11:04:55 +00:00
|
|
|
(lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-06-05 15:53:02 +00: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'
|
|
|
|
|
|
|
|
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"
|
2024-09-19 14:19:46 +00:00
|
|
|
# Uses asyncore, which is deprecated in python 3.12+
|
|
|
|
"tests/unit/io/test_asyncorereactor.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
|
|
|
];
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
optional-dependencies = {
|
2023-11-16 04:20:00 +00:00
|
|
|
cle = [ cryptography ];
|
|
|
|
eventlet = [ eventlet ];
|
|
|
|
gevent = [ gevent ];
|
|
|
|
graph = [ gremlinpython ];
|
|
|
|
metrics = [ scales ];
|
|
|
|
twisted = [ twisted ];
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
meta = {
|
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";
|
2024-09-19 14:19:46 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = with lib.maintainers; [ ris ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|