diff --git a/pkgs/development/python-modules/cassandra-driver/default.nix b/pkgs/development/python-modules/cassandra-driver/default.nix index c850c6a89dd0..9548bd1214d8 100644 --- a/pkgs/development/python-modules/cassandra-driver/default.nix +++ b/pkgs/development/python-modules/cassandra-driver/default.nix @@ -3,33 +3,31 @@ stdenv, buildPythonPackage, cryptography, - cython_0, + cython, eventlet, fetchFromGitHub, + fetchpatch2, geomet, gevent, gremlinpython, iana-etc, libev, libredirect, - mock, - nose, pytestCheckHook, - pythonOlder, pytz, pyyaml, scales, six, sure, twisted, + setuptools, + distutils, }: buildPythonPackage rec { pname = "cassandra-driver"; version = "3.29.1"; - format = "setuptools"; - - disabled = pythonOlder "3.7"; + pyproject = true; src = fetchFromGitHub { owner = "datastax"; @@ -38,29 +36,53 @@ buildPythonPackage rec { hash = "sha256-pnNm5Pd5k4bt+s3GrUUDWRpSdqNSM89GiX8DZKYzW1E="; }; - postPatch = '' - substituteInPlace setup.py \ - --replace 'geomet>=0.1,<0.3' 'geomet' - ''; + 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="; + }) + ]; - nativeBuildInputs = [ cython_0 ]; + pythonRelaxDeps = [ "geomet" ]; + + build-system = [ + distutils + setuptools + cython + ]; buildInputs = [ libev ]; - propagatedBuildInputs = [ + dependencies = [ six geomet ]; nativeCheckInputs = [ pytestCheckHook - mock - nose pytz pyyaml sure ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); + # This is used to determine the version of cython that can be used + CASS_DRIVER_ALLOWED_CYTHON_VERSION = cython.version; + # Make /etc/protocols accessible to allow socket.getprotobyname('tcp') in sandbox, # also /etc/resolv.conf is referenced by some tests preCheck = @@ -92,6 +114,8 @@ buildPythonPackage rec { disabledTestPaths = [ # requires puresasl "tests/unit/advanced/test_auth.py" + # Uses asyncore, which is deprecated in python 3.12+ + "tests/unit/io/test_asyncorereactor.py" ]; disabledTests = [ @@ -112,11 +136,11 @@ buildPythonPackage rec { twisted = [ twisted ]; }; - meta = with lib; { + meta = { description = "Python client driver for Apache Cassandra"; homepage = "http://datastax.github.io/python-driver"; changelog = "https://github.com/datastax/python-driver/blob/${version}/CHANGELOG.rst"; - license = licenses.asl20; - maintainers = with maintainers; [ ris ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ ris ]; }; }