1{
2 buildPythonPackage,
3 callPackage,
4 fetchPypi,
5 isPy27,
6 pythonOlder,
7 lib,
8 cryptography,
9 grpcio,
10 pyyaml,
11 grpcio-tools,
12 hadoop,
13 pytestCheckHook,
14 python,
15 setuptools,
16 versioneer,
17}:
18
19buildPythonPackage rec {
20 pname = "skein";
21 version = "0.8.2";
22 pyproject = true;
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-nXTqsJNX/LwAglPcPZkmdYPfF+vDLN+nNdZaDFTrHzE=";
26 };
27
28 # Update this hash if bumping versions
29 jarHash = "sha256-x2KH6tnoG7sogtjrJvUaxy0PCEA8q/zneuI969oBOKo=";
30 skeinJar = callPackage ./skeinjar.nix { inherit pname version jarHash; };
31
32 propagatedBuildInputs = [
33 cryptography
34 grpcio
35 pyyaml
36 ]
37 ++ lib.optionals (!pythonOlder "3.12") [ setuptools ];
38 buildInputs = [ grpcio-tools ];
39
40 preBuild = ''
41 # Ensure skein.jar exists skips the maven build in setup.py
42 mkdir -p skein/java
43 ln -s ${skeinJar} skein/java/skein.jar
44 '';
45
46 postPatch = ''
47 substituteInPlace skein/core.py --replace "'yarn'" "'${hadoop}/bin/yarn'" \
48 --replace "else 'java'" "else '${hadoop.jdk}/bin/java'"
49 # Remove vendorized versioneer
50 rm versioneer.py
51 ''
52 + lib.optionalString (!pythonOlder "3.12") ''
53 substituteInPlace skein/utils.py \
54 --replace-fail "distutils" "setuptools._distutils"
55 '';
56
57 build-system = [ versioneer ];
58
59 pythonImportsCheck = [ "skein" ];
60
61 nativeCheckInputs = [ pytestCheckHook ];
62 # These tests require connecting to a YARN cluster. They could be done through NixOS tests later.
63 disabledTests = [
64 "test_ui"
65 "test_tornado"
66 "test_kv"
67 "test_core"
68 "test_cli"
69 ];
70
71 meta = {
72 homepage = "https://jcristharif.com/skein";
73 description = "Tool and library for easily deploying applications on Apache YARN";
74 mainProgram = "skein";
75 license = lib.licenses.bsd3;
76 maintainers = with lib.maintainers; [
77 alexbiehl
78 illustris
79 ];
80 # https://github.com/NixOS/nixpkgs/issues/48663#issuecomment-1083031627
81 # replace with https://github.com/NixOS/nixpkgs/pull/140325 once it is merged
82 broken = lib.traceIf isPy27 "${pname} not supported on ${python.executable}" isPy27;
83 };
84}