2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pythonOlder
|
|
|
|
, isPy27
|
|
|
|
, cmake
|
|
|
|
, protobuf
|
|
|
|
, numpy
|
|
|
|
, six
|
|
|
|
, typing-extensions
|
|
|
|
, typing
|
|
|
|
, pytestrunner
|
|
|
|
, pytest
|
|
|
|
, nbval
|
|
|
|
, tabulate
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "onnx";
|
2021-03-09 03:18:52 +00:00
|
|
|
version = "1.8.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Due to Protobuf packaging issues this build of Onnx with Python 2 gives
|
2020-05-15 21:57:56 +00:00
|
|
|
# errors on import.
|
|
|
|
# Also support for Python 2 will be deprecated from Onnx v1.8.
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-03-09 03:18:52 +00:00
|
|
|
sha256 = "9d65c52009a90499f8c25fdfe5acda3ac88efe0788eb1d5f2575a989277145fb";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
protobuf
|
|
|
|
numpy
|
|
|
|
six
|
|
|
|
typing-extensions
|
|
|
|
] ++ lib.optional (pythonOlder "3.5") [ typing ];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytestrunner
|
|
|
|
pytest
|
|
|
|
nbval
|
|
|
|
tabulate
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-03-20 04:20:00 +00:00
|
|
|
chmod +x tools/protoc-gen-mypy.sh.in
|
|
|
|
patchShebangs tools/protoc-gen-mypy.sh.in tools/protoc-gen-mypy.py
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
preBuild = ''
|
|
|
|
export MAX_JOBS=$NIX_BUILD_CORES
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# The executables are just utility scripts that aren't too important
|
|
|
|
postInstall = ''
|
|
|
|
rm -r $out/bin
|
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
# The setup.py does all the configuration
|
|
|
|
dontUseCmakeConfigure = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://onnx.ai";
|
|
|
|
description = "Open Neural Network Exchange";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.acairncross ];
|
|
|
|
};
|
|
|
|
}
|