forked from pool/python-onnx
Accepting request 872636 from home:bnavigator:branches:science:machinelearning
- NEP 29: Tumbleweed does not have python36-numpy and depending packages anymore. Skip python36 build. - Make setup.py cmake call and %cmake macros compatible, even for multiple python3 flavors (when we get python39) - Fix boo#1182258 OBS-URL: https://build.opensuse.org/request/show/872636 OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/python-onnx?expand=0&rev=28
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Feb 15 18:25:39 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- NEP 29: Tumbleweed does not have python36-numpy and depending
|
||||||
|
packages anymore. Skip python36 build.
|
||||||
|
- Make setup.py cmake call and %cmake macros compatible, even for
|
||||||
|
multiple python3 flavors (when we get python39)
|
||||||
|
- Fix boo#1182258
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 5 08:50:45 UTC 2021 - Guillaume GARDET <guillaume.gardet@opensuse.org>
|
Fri Feb 5 08:50:45 UTC 2021 - Guillaume GARDET <guillaume.gardet@opensuse.org>
|
||||||
|
|
||||||
|
@@ -15,8 +15,11 @@
|
|||||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%define skip_python2 1
|
%define skip_python2 1
|
||||||
|
# Tumbleweed does not have a python36-numpy anymore: NEP 29 dropped Python 3.6 for NumPy 1.20
|
||||||
|
%define skip_python36 1
|
||||||
Name: python-onnx
|
Name: python-onnx
|
||||||
Version: 1.8.1
|
Version: 1.8.1
|
||||||
Release: 0
|
Release: 0
|
||||||
@@ -100,31 +103,21 @@ This packages includes the data for testing the backend.
|
|||||||
# avoid bundles
|
# avoid bundles
|
||||||
rm -rf third_party
|
rm -rf third_party
|
||||||
%autopatch -p1
|
%autopatch -p1
|
||||||
# say that the cmake was already built (we used our macros)
|
# build inside python_expand shuffled build dir also used by the cmake macro instead of upstream's custom dirname
|
||||||
sed -i -e 's:built = False:built = True:g' setup.py
|
sed -i "/^CMAKE_BUILD_DIR = / s/TOP_DIR, '.setuptools-cmake-build'/TOP_DIR, 'build'/" setup.py
|
||||||
# do not require extra pytest modules
|
# do not require extra pytest modules
|
||||||
sed -i -e '/addopts/d' setup.cfg
|
sed -i -e '/addopts/d' setup.cfg
|
||||||
# do not pull in pytest-runner as it is deprecated
|
# do not pull in pytest-runner as it is deprecated
|
||||||
sed -i -e '/pytest-runner/d' setup.py
|
sed -i -e '/pytest-runner/d' setup.py
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# define same folder like is used for the setup.py later
|
%{python_expand # Generate the build system using the distro macro, configuring everything to taste for every python flavor.
|
||||||
%define __builddir .setuptools-cmake-build
|
%cmake -DONNX_USE_PROTOBUF_SHARED_LIBS:BOOL=ON \
|
||||||
# FIXME: you should use %%cmake macros
|
-DONNX_WERROR:BOOL=OFF
|
||||||
# Force the cmake to build static libs as otherwise we end
|
# the macro stays in build/
|
||||||
# up with unresolvable package.
|
cd ..
|
||||||
%{python_expand # we need to generate for each python
|
|
||||||
%cmake \
|
|
||||||
-DONNX_USE_PROTOBUF_SHARED_LIBS=ON \
|
|
||||||
-DONNX_WERROR=OFF \
|
|
||||||
-DBUILD_ONNX_PYTHON=ON \
|
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
|
||||||
-DBUILD_STATIC_LIBS=OFF \
|
|
||||||
-DPYTHON_EXECUTABLE="%{_bindir}/$python" \
|
|
||||||
-DPY_EXT_SUFFIX="`$python-config --extension-suffix`" \
|
|
||||||
%{nil}
|
|
||||||
%cmake_build ; cd ..
|
|
||||||
}
|
}
|
||||||
|
# let setup.py do the cmake build call (for every flavor)
|
||||||
%python_build
|
%python_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@@ -133,23 +126,34 @@ sed -i -e '/pytest-runner/d' setup.py
|
|||||||
%python_clone -a %{buildroot}%{_bindir}/backend-test-tools
|
%python_clone -a %{buildroot}%{_bindir}/backend-test-tools
|
||||||
%python_clone -a %{buildroot}%{_bindir}/check-node
|
%python_clone -a %{buildroot}%{_bindir}/check-node
|
||||||
%python_clone -a %{buildroot}%{_bindir}/check-model
|
%python_clone -a %{buildroot}%{_bindir}/check-model
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
%{python_expand # fix shebang
|
||||||
shebang_files="%{python_sitearch}/onnx/backend/test/stat_coverage.py %{python_sitearch}/onnx/defs/gen_doc.py %{python_sitearch}/onnx/gen_proto.py"
|
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
|
for file in $shebang_files ; do
|
||||||
sed -i 's@%{_bindir}/env python@%{_bindir}/python3@' %{buildroot}/$file
|
sed -i 's|%{_bindir}/env python.*$|%{_bindir}/$python|' %{buildroot}/$file
|
||||||
chmod 755 %{buildroot}/$file
|
chmod 755 %{buildroot}/$file
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
%{?python_compileall}
|
||||||
|
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
export PYTHONDONTWRITEBYTECODE=1
|
|
||||||
export LD_LIBRARY_PATH="%{buildroot}%{_libdir}"
|
export LD_LIBRARY_PATH="%{buildroot}%{_libdir}"
|
||||||
# copy inplace for tests
|
# copy tests into clean subdir and test the installed lib in sitearch
|
||||||
cp %{__builddir}/*cpp2py* ./onnx/
|
mkdir cleantestdir
|
||||||
|
cp -r onnx/test onnx/examples cleantestdir/
|
||||||
|
pushd cleantestdir
|
||||||
# skip online tests
|
# skip online tests
|
||||||
%{python_expand # test with both $python sitearch and sitelib
|
donttest=" test_bvlc_alexnet_cpu \
|
||||||
export PYTHONPATH="%{buildroot}%{$python_sitearch}:%{buildroot}%{$python_sitelib}"
|
or test_shufflenet_cpu \
|
||||||
$python -m pytest -v -n auto -k 'not (test_bvlc_alexnet_cpu or test_shufflenet_cpu or test_densenet121_cpu or test_squeezenet_cpu or test_inception_v1_cpu or test_vgg19_cpu or test_inception_v2_cpu or test_zfnet512_cpu or test_resnet50_cpu)'
|
or test_densenet121_cpu \
|
||||||
}
|
or test_squeezenet_cpu \
|
||||||
|
or test_inception_v1_cpu \
|
||||||
|
or test_vgg19_cpu \
|
||||||
|
or test_inception_v2_cpu \
|
||||||
|
or test_zfnet512_cpu \
|
||||||
|
or test_resnet50_cpu"
|
||||||
|
%pytest_arch -n auto -k "not ($donttest)" -ra
|
||||||
|
popd
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%python_install_alternative backend-test-tools
|
%python_install_alternative backend-test-tools
|
||||||
|
Reference in New Issue
Block a user