summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyorc/default.nix
blob: efbf3f9cdce9f291bc6bb183c5aac24cb9831eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pybind11,
  setuptools,
  pytestCheckHook,
  tzdata,
  python,
  pkgs,
}:

buildPythonPackage rec {
  pname = "pyorc";
  version = "0.10.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "noirello";
    repo = "pyorc";
    tag = "v${version}";
    hash = "sha256-2w3Qh6g+Yg+D10kTow9YR6B6FhQ+z2DvgDy5GtYxH4g=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail \
        '"pybind11>2.6.0,<3.0"' \
        '"pybind11>2.6.0"'
  '';

  build-system = [
    pybind11
    setuptools
  ];

  env = {
    PYORC_SKIP_ORC_BUILD = "true";
  };

  buildInputs = [
    pkgs.lz4
    pkgs.protobuf_31
    pkgs.snappy
    pkgs.zlib
    pkgs.zstd
    pkgs.apache-orc
  ];

  preCheck = ''
    # provide timezone data, works only on linux
    export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo

    substituteInPlace "tests/compare/test_writer_cmp.py" \
      --replace-fail "deps/bin/orc-contents" "orc-contents"

    substituteInPlace "tests/compare/test_reader_cmp.py" \
      --replace-fail "deps/bin/orc-metadata" "orc-metadata"

    mkdir -p deps
    ln -s "${pkgs.apache-orc.src}/examples" "deps/"
  '';

  pythonImportsCheck = [
    "pyorc"
  ];

  nativeCheckInputs = [
    pytestCheckHook
    pkgs.apache-orc
  ];

  meta = {
    changelog = "https://github.com/noirello/pyorc/blob/${version}/CHANGELOG.rst";
    description = "Python module for Apache ORC file format";
    homepage = "https://github.com/noirello/pyorc";
    license = lib.licenses.asl20;
    maintainers = [ ];
  };
}