Merge pull request #100989 from risicle/ris-turion-cassandra-driver

This commit is contained in:
Sandro 2021-01-31 21:21:13 +01:00 committed by GitHub
commit ba64d090c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 149 additions and 16 deletions

@ -1,47 +1,85 @@
{ lib, buildPythonPackage, fetchPypi, python, pythonOlder { stdenv, lib, buildPythonPackage, fetchFromGitHub, python, pythonOlder
, cython , cython
, eventlet , eventlet
, futures , futures
, iana-etc
, geomet
, libev , libev
, mock , mock
, nose , nose
, pytest , pytestCheckHook
, pytz , pytz
, pyyaml , pyyaml
, scales , scales
, six , six
, sure , sure
, gremlinpython
, gevent
, twisted
, libredirect
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "cassandra-driver"; pname = "cassandra-driver";
version = "3.24.0"; version = "3.24.0";
src = fetchPypi { # pypi tarball doesn't include tests
inherit pname version; src = fetchFromGitHub {
sha256 = "83ec8d9a5827ee44bb1c0601a63696a8a9086beaf0151c8255556299246081bd"; owner = "datastax";
repo = "python-driver";
rev = version;
sha256 = "1rr69hly5q810xpn8rkzxwzlq55wxxp7kwki9vfri3gh674d2wip";
}; };
nativeBuildInputs = [ cython ]; nativeBuildInputs = [ cython ];
buildInputs = [ libev ]; buildInputs = [ libev ];
propagatedBuildInputs = [ six ] propagatedBuildInputs = [ six geomet ]
++ lib.optionals (pythonOlder "3.4") [ futures ]; ++ lib.optionals (pythonOlder "3.4") [ futures ];
checkInputs = [ eventlet mock nose pytest pytz pyyaml sure ]; # Make /etc/protocols accessible to allow socket.getprotobyname('tcp') in sandbox,
# also /etc/resolv.conf is referenced by some tests
# ignore test files which try to do socket.getprotocolname('tcp') preCheck = (stdenv.lib.optionalString stdenv.isLinux ''
# as it fails in sandbox mode due to lack of a /etc/protocols file echo "nameserver 127.0.0.1" > resolv.conf
checkPhase = '' export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
pytest tests/unit \ export LD_PRELOAD=${libredirect}/lib/libredirect.so
--ignore=tests/unit/io/test_libevreactor.py \ '') + ''
--ignore=tests/unit/io/test_eventletreactor.py \ # increase tolerance for time-based test
--ignore=tests/unit/io/test_asyncorereactor.py substituteInPlace tests/unit/io/utils.py --replace 'delta=.15' 'delta=.3'
''; '';
postCheck = ''
unset NIX_REDIRECTS LD_PRELOAD
'';
checkInputs = [
pytestCheckHook
eventlet
mock
nose
pytz
pyyaml
sure
scales
gremlinpython
gevent
twisted
];
pytestFlagsArray = [
"tests/unit"
# requires puresasl
"--ignore=tests/unit/advanced/test_auth.py"
];
disabledTests = [
# doesn't seem to be intended to be run directly
"_PoolTests"
# attempts to make connection to localhost
"test_connection_initialization"
];
meta = with lib; { meta = with lib; {
description = "A Python client driver for Apache Cassandra"; description = "A Python client driver for Apache Cassandra";
homepage = "http://datastax.github.io/python-driver"; homepage = "http://datastax.github.io/python-driver";
license = licenses.asl20; license = licenses.asl20;
broken = true; # geomet doesn't exist maintainers = with maintainers; [ turion ris ];
}; };
} }

@ -0,0 +1,37 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, click
, six
}:
buildPythonPackage rec {
pname = "geomet";
version = "0.2.1";
# pypi tarball doesn't include tests
src = fetchFromGitHub {
owner = "geomet";
repo = "geomet";
rev = version;
sha256 = "0fdi26glsmrsyqk86rnsfcqw79svn2b0ikdv89pq98ihrpwhn85y";
};
patches = [
(fetchpatch {
name = "python-3.8-support.patch";
url = "https://github.com/geomet/geomet/commit/dc4cb4a856d3ad814b57b4b7487d86d9e0f0fad4.patch";
sha256 = "1f1cdfqyp3z01jdjvax77219l3gc75glywqrisqpd2k0m0g7fwh3";
})
];
propagatedBuildInputs = [ click six ];
meta = with lib; {
homepage = "https://github.com/geomet/geomet";
license = licenses.asl20;
description = "Convert GeoJSON to WKT/WKB (Well-Known Text/Binary), and vice versa.";
maintainers = with maintainers; [ turion ris ];
};
}

@ -0,0 +1,54 @@
{ stdenv, lib, buildPythonPackage, fetchFromGitHub, python, pythonOlder
, pytestCheckHook, pyhamcrest, pytestrunner, pytest
, six, isodate, tornado, aenum, radish-bdd, mock
}:
buildPythonPackage rec {
pname = "gremlinpython";
version = "3.4.8";
# pypi tarball doesn't include tests
src = fetchFromGitHub {
owner = "apache";
repo = "tinkerpop";
rev = version;
sha256 = "0kcyhfxz7z4f8i64gig8q1q9dhy24cprbh63vwsdiwryg74q4chl";
};
sourceRoot = "source/gremlin-python/src/main/jython";
postPatch = ''
substituteInPlace setup.py \
--replace 'tornado>=4.4.1,<6.0' 'tornado' \
--replace 'PyHamcrest>=1.9.0,<2.0.0' 'PyHamcrest' \
--replace 'radish-bdd==0.8.6' 'radish-bdd' \
--replace 'mock>=3.0.5,<4.0.0' 'mock' \
--replace 'pytest>=4.6.4,<5.0.0' 'pytest'
'';
nativeBuildInputs = [ pytestrunner ]; # simply to placate requirements
propagatedBuildInputs = [ six isodate tornado aenum ];
checkInputs = [ pytestCheckHook pyhamcrest radish-bdd mock ];
# disable custom pytest report generation
preCheck = ''
substituteInPlace setup.cfg --replace 'addopts' '#addopts'
'';
# many tests expect a running tinkerpop server
pytestFlagsArray = [
"--ignore=tests/driver/test_client.py"
"--ignore=tests/driver/test_driver_remote_connection.py"
"--ignore=tests/driver/test_driver_remote_connection_threaded.py"
"--ignore=tests/process/test_dsl.py"
"--ignore=tests/structure/io/test_functionalityio.py"
# disabledTests doesn't quite allow us to be precise enough for this
"-k 'not (TestFunctionalGraphSONIO and (test_timestamp or test_datetime or test_uuid))'"
];
meta = with lib; {
description = "Gremlin-Python implements Gremlin, the graph traversal language of Apache TinkerPop, within the Python language";
homepage = "https://tinkerpop.apache.org/";
license = licenses.asl20;
maintainers = with maintainers; [ turion ris ];
};
}

@ -2526,6 +2526,8 @@ in {
geojson-client = callPackage ../development/python-modules/geojson-client { }; geojson-client = callPackage ../development/python-modules/geojson-client { };
geomet = callPackage ../development/python-modules/geomet { };
geopandas = callPackage ../development/python-modules/geopandas { }; geopandas = callPackage ../development/python-modules/geopandas { };
geopy = if isPy3k then geopy = if isPy3k then
@ -2793,6 +2795,8 @@ in {
grequests = callPackage ../development/python-modules/grequests { }; grequests = callPackage ../development/python-modules/grequests { };
gremlinpython = callPackage ../development/python-modules/gremlinpython { };
grib-api = disabledIf (!isPy27) (toPythonModule (pkgs.grib-api.override { grib-api = disabledIf (!isPy27) (toPythonModule (pkgs.grib-api.override {
enablePython = true; enablePython = true;
pythonPackages = self; pythonPackages = self;