SHA256
1
0
forked from pool/python-onnx

Testing needs more work

- Force building with system cmake to respect system definitions
  and to provide debug information for later on

OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/python-onnx?expand=0&rev=8
This commit is contained in:
Tomáš Chvátal
2020-02-24 14:53:41 +00:00
committed by Git OBS Bridge
parent 3c8b49d462
commit ce82febda3
2 changed files with 25 additions and 11 deletions

View File

@@ -18,18 +18,17 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-onnx
Version: 1.6.0
Release: 0
Summary: Open Neural Network Exchange
License: MIT
Group: Development/Languages/Python
URL: https://onnx.ai/
Source0: https://github.com/onnx/onnx/archive/v%{version}.tar.gz#/onnx-%{version}.tar.gz
Source1: %{name}-rpmlintrc
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pybind11}
BuildRequires: %{python_module nbval}
BuildRequires: %{python_module pybind11-devel}
BuildRequires: %{python_module pytest-runner}
BuildRequires: %{python_module setuptools}
BuildRequires: cmake
@@ -42,8 +41,6 @@ Requires: python-numpy
Requires: python-protobuf
Requires: python-six
Requires: python-typing_extensions >= 3.6.2.1
Suggests: python-mypy >= 0.600
%python_subpackages
%description
@@ -51,7 +48,6 @@ Open format to represent deep learning models. With ONNX, AI developers can more
%package devel
Summary: C/C++ - header files which are used for development
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description devel
@@ -59,9 +55,20 @@ The headers and other files needed for the development.
%prep
%setup -q -n onnx-%{version}
# avoid bundles
rm -rf third_party
# say that the cmake was already built (we used our macros)
sed -i -e 's:built = False:built = True:g' setup.py
%build
export CFLAGS="%{optflags}"
# define same folder like is used for the setup.py later
%define __builddir .setuptools-cmake-build
%cmake \
-DONNX_USE_PROTOBUF_SHARED_LIBS=ON \
-DONNX_WERROR=OFF \
-DBUILD_ONNX_PYTHON=ON \
-DPY_EXT_SUFFIX="`python3-config --extension-suffix`"
%cmake_build ; cd ..
%python_build
%install
@@ -69,15 +76,16 @@ export CFLAGS="%{optflags}"
%python_expand %fdupes %{buildroot}%{$python_sitearch}
shebang_files="%{python_sitearch}/onnx/backend/test/stat_coverage.py %{python_sitearch}/onnx/defs/gen_doc.py %{python_sitearch}/onnx/gen_proto.py"
for file in $shebang_files ; do
sed -i 's@/usr/bin/env python@/usr/bin/python3@' %{buildroot}/$file
sed -i 's@%{_bindir}/env python@%{_bindir}/python3@' %{buildroot}/$file
chmod 755 %{buildroot}/$file
done
# check fails with buitling typing of python 3.7.3
# https://github.com/pybind/pybind11/issues/1949
%check
#%%pytest_arch
%files %{python_files}
%doc README.md
%license LICENSE
%license LICENSE
%python3_only %{_bindir}/check-model
%python3_only %{_bindir}/check-node
%python3_only %{_bindir}/backend-test-tools