2019-10-16 00:31:30 +01:00
|
|
|
{ lib
|
|
|
|
, fetchpatch
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pythonOlder
|
|
|
|
, isPy27
|
|
|
|
, cmake
|
|
|
|
, protobuf
|
|
|
|
, numpy
|
|
|
|
, six
|
|
|
|
, typing-extensions
|
|
|
|
, typing
|
|
|
|
, pytestrunner
|
|
|
|
, pytest
|
|
|
|
, nbval
|
|
|
|
, tabulate
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "onnx";
|
2020-11-10 09:21:59 +00:00
|
|
|
version = "1.8.0";
|
2019-10-16 00:31:30 +01:00
|
|
|
|
|
|
|
# Due to Protobuf packaging issues this build of Onnx with Python 2 gives
|
2020-05-11 19:46:44 +01:00
|
|
|
# errors on import.
|
|
|
|
# Also support for Python 2 will be deprecated from Onnx v1.8.
|
2019-10-16 00:31:30 +01:00
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-11-10 09:21:59 +00:00
|
|
|
sha256 = "5f787fd3ce1290e12da335237b3b921152157e51aa09080b65631b3ce3fcc50c";
|
2019-10-16 00:31:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
protobuf
|
|
|
|
numpy
|
|
|
|
six
|
|
|
|
typing-extensions
|
|
|
|
] ++ lib.optional (pythonOlder "3.5") [ typing ];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytestrunner
|
|
|
|
pytest
|
|
|
|
nbval
|
|
|
|
tabulate
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs tools/protoc-gen-mypy.py
|
|
|
|
'';
|
|
|
|
|
2020-05-11 19:46:44 +01:00
|
|
|
preBuild = ''
|
|
|
|
export MAX_JOBS=$NIX_BUILD_CORES
|
|
|
|
'';
|
|
|
|
|
2019-10-16 00:31:30 +01:00
|
|
|
# The executables are just utility scripts that aren't too important
|
|
|
|
postInstall = ''
|
|
|
|
rm -r $out/bin
|
|
|
|
'';
|
|
|
|
|
2020-05-11 19:46:44 +01:00
|
|
|
# The setup.py does all the configuration
|
|
|
|
dontUseCmakeConfigure = true;
|
2019-10-16 00:31:30 +01:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://onnx.ai";
|
2019-10-16 00:31:30 +01:00
|
|
|
description = "Open Neural Network Exchange";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.acairncross ];
|
|
|
|
};
|
|
|
|
}
|