From 8b9ab2355d9ac6f63d04cb466b3c4aff55c20125 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Sun, 28 Jul 2024 23:12:21 -0400 Subject: [PATCH 1/2] python312Packages.cassandra-driver: drop nose dependency --- .../python-modules/cassandra-driver/default.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/cassandra-driver/default.nix b/pkgs/development/python-modules/cassandra-driver/default.nix index c850c6a89dd0..db40d5e1a6d8 100644 --- a/pkgs/development/python-modules/cassandra-driver/default.nix +++ b/pkgs/development/python-modules/cassandra-driver/default.nix @@ -13,9 +13,7 @@ libev, libredirect, mock, - nose, pytestCheckHook, - pythonOlder, pytz, pyyaml, scales, @@ -29,8 +27,6 @@ buildPythonPackage rec { version = "3.29.1"; format = "setuptools"; - disabled = pythonOlder "3.7"; - src = fetchFromGitHub { owner = "datastax"; repo = "python-driver"; @@ -41,9 +37,13 @@ buildPythonPackage rec { postPatch = '' substituteInPlace setup.py \ --replace 'geomet>=0.1,<0.3' 'geomet' + substituteInPlace tests/unit/test_response_future.py \ + --replace-fail "assertRaisesRegexp" "assertRaisesRegex" ''; - nativeBuildInputs = [ cython_0 ]; + build-system = [ + cython + ]; buildInputs = [ libev ]; @@ -55,12 +55,13 @@ buildPythonPackage rec { 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 +93,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 = [ From b31a6e472df527b42a938e944b8da5d62885c3cf Mon Sep 17 00:00:00 2001 From: Pyrox Date: Sun, 28 Jul 2024 23:12:30 -0400 Subject: [PATCH 2/2] python312Packages.cassandra-driver: modernize --- .../cassandra-driver/default.nix | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/cassandra-driver/default.nix b/pkgs/development/python-modules/cassandra-driver/default.nix index db40d5e1a6d8..9548bd1214d8 100644 --- a/pkgs/development/python-modules/cassandra-driver/default.nix +++ b/pkgs/development/python-modules/cassandra-driver/default.nix @@ -3,16 +3,16 @@ stdenv, buildPythonPackage, cryptography, - cython_0, + cython, eventlet, fetchFromGitHub, + fetchpatch2, geomet, gevent, gremlinpython, iana-etc, libev, libredirect, - mock, pytestCheckHook, pytz, pyyaml, @@ -20,12 +20,14 @@ six, sure, twisted, + setuptools, + distutils, }: buildPythonPackage rec { pname = "cassandra-driver"; version = "3.29.1"; - format = "setuptools"; + pyproject = true; src = fetchFromGitHub { owner = "datastax"; @@ -34,27 +36,45 @@ buildPythonPackage rec { hash = "sha256-pnNm5Pd5k4bt+s3GrUUDWRpSdqNSM89GiX8DZKYzW1E="; }; - postPatch = '' - substituteInPlace setup.py \ - --replace 'geomet>=0.1,<0.3' 'geomet' - substituteInPlace tests/unit/test_response_future.py \ - --replace-fail "assertRaisesRegexp" "assertRaisesRegex" - ''; + 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="; + }) + ]; + + pythonRelaxDeps = [ "geomet" ]; build-system = [ + distutils + setuptools cython ]; buildInputs = [ libev ]; - propagatedBuildInputs = [ + dependencies = [ six geomet ]; nativeCheckInputs = [ pytestCheckHook - mock pytz pyyaml sure @@ -62,6 +82,7 @@ buildPythonPackage rec { # 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 = @@ -115,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 ]; }; }