python3Packages.skein: fix broken package
- Use prebuilt jar to get around maven builds being non-reproducible - Remove unnecessary propagated dependencies - Inherit java version from hadoop
This commit is contained in:
parent
ba88a5afa6
commit
66e625348e
|
@ -2,26 +2,29 @@
|
||||||
, callPackage
|
, callPackage
|
||||||
, fetchPypi
|
, fetchPypi
|
||||||
, isPy27
|
, isPy27
|
||||||
, jre
|
|
||||||
, lib
|
, lib
|
||||||
, pythonPackages
|
, cryptography
|
||||||
|
, grpcio
|
||||||
|
, pyyaml
|
||||||
|
, grpcio-tools
|
||||||
|
, hadoop
|
||||||
|
, pytestCheckHook
|
||||||
|
, python
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
buildPythonPackage rec {
|
||||||
pname = "skein";
|
pname = "skein";
|
||||||
version = "0.8.1";
|
version = "0.8.1";
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
sha256 = "04208b4be9df2dc68ac5b3e3ae51fd9b589add95ea1b67222a8de754d17b1efa";
|
sha256 = "04208b4be9df2dc68ac5b3e3ae51fd9b589add95ea1b67222a8de754d17b1efa";
|
||||||
};
|
};
|
||||||
skeinJar = callPackage ./skeinjar.nix { inherit src version; };
|
# Update this hash if bumping versions
|
||||||
in
|
jarHash = "sha256-UGiEoTZ17IhLG72FZ18Zb+Ej4T8z9rMIMDUxzSZGZyY=";
|
||||||
buildPythonPackage rec {
|
skeinJar = callPackage ./skeinjar.nix { inherit pname version jarHash; };
|
||||||
inherit pname version src;
|
|
||||||
disabled = isPy27;
|
|
||||||
|
|
||||||
propagatedBuildInputs = with pythonPackages; [ cryptography grpcio grpcio-tools jupyter pytest pyyaml requests jre ];
|
propagatedBuildInputs = [ cryptography grpcio pyyaml ];
|
||||||
|
buildInputs = [ grpcio-tools ];
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
# Ensure skein.jar exists skips the maven build in setup.py
|
# Ensure skein.jar exists skips the maven build in setup.py
|
||||||
|
@ -29,12 +32,30 @@ buildPythonPackage rec {
|
||||||
ln -s ${skeinJar} skein/java/skein.jar
|
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'"
|
||||||
|
'';
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "skein" ];
|
||||||
|
|
||||||
|
checkInputs = [ 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 = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://jcristharif.com/skein";
|
homepage = "https://jcristharif.com/skein";
|
||||||
description = "A tool and library for easily deploying applications on Apache YARN";
|
description = "A tool and library for easily deploying applications on Apache YARN";
|
||||||
license = licenses.bsd3;
|
license = licenses.bsd3;
|
||||||
maintainers = with maintainers; [ alexbiehl ];
|
maintainers = with maintainers; [ alexbiehl illustris ];
|
||||||
broken = true; # maven repo src isn't stable
|
# 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
{ callPackage, stdenv, maven, src, version }:
|
{ fetchPypi, unzip, stdenv, pname, version, jarHash }:
|
||||||
|
|
||||||
let
|
|
||||||
skeinRepo = callPackage ./skeinrepo.nix { inherit src version; };
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "skein.jar";
|
inherit pname version;
|
||||||
|
|
||||||
inherit version src;
|
src = fetchPypi {
|
||||||
|
inherit pname version;
|
||||||
|
format = "wheel";
|
||||||
|
hash = jarHash;
|
||||||
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ maven ];
|
dontUnpack = true;
|
||||||
|
|
||||||
buildPhase = ''
|
nativeBuildInputs = [ unzip ];
|
||||||
mvn --offline -f java/pom.xml package -Dmaven.repo.local="${skeinRepo}" -Dskein.version=${version} -Dversion=${version}
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
# Making sure skein.jar exists skips the maven build in setup.py
|
unzip ${src}
|
||||||
mv java/target/skein-*.jar $out
|
mv ./skein/java/skein.jar $out
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
{ autoPatchelfHook, lib, maven, stdenv, src, version }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "skein-maven-repo";
|
|
||||||
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ maven ] ++ lib.optional stdenv.isLinux autoPatchelfHook;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
|
|
||||||
archs="${
|
|
||||||
if stdenv.isLinux
|
|
||||||
then "linux-x86_32 linux-x86_64"
|
|
||||||
else "osx-x86_64"
|
|
||||||
}"
|
|
||||||
|
|
||||||
for arch in $archs
|
|
||||||
do
|
|
||||||
mvn -Dmaven.repo.local=$out dependency:get -Dartifact=com.google.protobuf:protoc:3.0.0:exe:$arch
|
|
||||||
mvn -Dmaven.repo.local=$out dependency:get -Dartifact=io.grpc:protoc-gen-grpc-java:1.16.0:exe:$arch
|
|
||||||
done
|
|
||||||
|
|
||||||
if ${ lib.boolToString stdenv.isLinux }
|
|
||||||
then
|
|
||||||
autoPatchelf $out
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We have to use maven package here as dependency:go-offline doesn't
|
|
||||||
# fetch every required jar.
|
|
||||||
mvn -f java/pom.xml -Dmaven.repo.local=$out package
|
|
||||||
|
|
||||||
rm $(find $out -name _remote.repositories)
|
|
||||||
rm $(find $out -name resolver-status.properties)
|
|
||||||
'';
|
|
||||||
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHash = if stdenv.isLinux
|
|
||||||
then "12f0q3444qw6y4f6qsa9540a0fz4cgi844zzi8z1phqn3k4dnl6v"
|
|
||||||
else "0bjbwiv17cary1isxca0m2hsvgs1i5fh18z247h1hky73lnhbrz8";
|
|
||||||
|
|
||||||
} // lib.optionalAttrs stdenv.isLinux { dontAutoPatchelf = true; }
|
|
|
@ -9351,9 +9351,7 @@ in {
|
||||||
|
|
||||||
six = callPackage ../development/python-modules/six { };
|
six = callPackage ../development/python-modules/six { };
|
||||||
|
|
||||||
skein = callPackage ../development/python-modules/skein {
|
skein = callPackage ../development/python-modules/skein { };
|
||||||
jre = pkgs.jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
|
|
||||||
};
|
|
||||||
|
|
||||||
skidl = callPackage ../development/python-modules/skidl { };
|
skidl = callPackage ../development/python-modules/skidl { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue