1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonAtLeast
5, pythonOlder
6, attrs
7, isodate
8, python-dateutil
9, rfc3986
10, uritemplate
11, pytestCheckHook
12, pytest-mock
13}:
14
15buildPythonPackage rec {
16 pname = "csvw";
17 version = "1.11.0";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.6";
21
22 src = fetchFromGitHub {
23 owner = "cldf";
24 repo = "csvw";
25 rev = "v${version}";
26 sha256 = "1393xwqawaxsflbq62vks92vv4zch8p6dd1mdvdi7j4vvf0zljkg";
27 };
28
29 propagatedBuildInputs = [
30 attrs
31 isodate
32 python-dateutil
33 rfc3986
34 uritemplate
35 ];
36
37 checkInputs = [
38 pytestCheckHook
39 pytest-mock
40 ];
41
42 patchPhase = ''
43 substituteInPlace setup.cfg \
44 --replace "--cov" ""
45 '';
46
47 disabledTests = [
48 # this test is flaky on darwin because it depends on the resolution of filesystem mtimes
49 # https://github.com/cldf/csvw/blob/45584ad63ff3002a9b3a8073607c1847c5cbac58/tests/test_db.py#L257
50 "test_write_file_exists"
51 ] ++ lib.optionals (pythonAtLeast "3.10") [
52 # https://github.com/cldf/csvw/issues/58
53 "test_roundtrip_escapechar"
54 "test_escapequote_escapecharquotechar_final"
55 "test_doubleQuote"
56 ];
57
58 pythonImportsCheck = [
59 "csvw"
60 ];
61
62 meta = with lib; {
63 description = "CSV on the Web";
64 homepage = "https://github.com/cldf/csvw";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ hexa ];
67 };
68}