about summary refs log tree commit diff
path: root/pkgs/development/python-modules/skein/default.nix
blob: e9016bb32ac75e342e6163f2eb4af5d68c600ae9 (plain) (blame)
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
81
82
83
84
{
  buildPythonPackage,
  callPackage,
  fetchPypi,
  isPy27,
  pythonOlder,
  lib,
  cryptography,
  grpcio,
  pyyaml,
  grpcio-tools,
  hadoop,
  pytestCheckHook,
  python,
  setuptools,
  versioneer,
}:

buildPythonPackage rec {
  pname = "skein";
  version = "0.8.2";
  format = "setuptools";
  src = fetchPypi {
    inherit pname version;
    hash = "sha256-nXTqsJNX/LwAglPcPZkmdYPfF+vDLN+nNdZaDFTrHzE=";
  };

  # Update this hash if bumping versions
  jarHash = "sha256-x2KH6tnoG7sogtjrJvUaxy0PCEA8q/zneuI969oBOKo=";
  skeinJar = callPackage ./skeinjar.nix { inherit pname version jarHash; };

  propagatedBuildInputs = [
    cryptography
    grpcio
    pyyaml
  ] ++ lib.optionals (!pythonOlder "3.12") [ setuptools ];
  buildInputs = [ grpcio-tools ];

  preBuild = ''
    # Ensure skein.jar exists skips the maven build in setup.py
    mkdir -p skein/java
    ln -s ${skeinJar} skein/java/skein.jar
  '';

  postPatch =
    ''
      substituteInPlace skein/core.py --replace "'yarn'" "'${hadoop}/bin/yarn'" \
        --replace "else 'java'" "else '${hadoop.jdk}/bin/java'"
      # Remove vendorized versioneer
      rm versioneer.py
    ''
    + lib.optionalString (!pythonOlder "3.12") ''
      substituteInPlace skein/utils.py \
        --replace-fail "distutils" "setuptools._distutils"
    '';

  build-system = [ versioneer ];

  pythonImportsCheck = [ "skein" ];

  nativeCheckInputs = [ pytestCheckHook ];
  # These tests require connecting to a YARN cluster. They could be done through NixOS tests later.
  disabledTests = [
    "test_ui"
    "test_tornado"
    "test_kv"
    "test_core"
    "test_cli"
  ];

  meta = {
    homepage = "https://jcristharif.com/skein";
    description = "Tool and library for easily deploying applications on Apache YARN";
    mainProgram = "skein";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      alexbiehl
      illustris
    ];
    # https://github.com/NixOS/nixpkgs/issues/48663#issuecomment-1083031627
    # replace with https://github.com/NixOS/nixpkgs/pull/140325 once it is merged
    broken = lib.traceIf isPy27 "${pname} not supported on ${python.executable}" isPy27;
  };
}