Unverified Commit b31a6e47 authored by Pyrox's avatar Pyrox
Browse files

python312Packages.cassandra-driver: modernize

parent 8b9ab235
Loading
Loading
Loading
Loading
+35 −14
Original line number Diff line number Diff line
@@ -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 ];
  };
}