SHA256
1
0
forked from pool/python-onnx

- Force the interpreter to match the one during build

- Mypy should use python3 to generate stuff not python2
  * no-python2.patch

OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/python-onnx?expand=0&rev=19
This commit is contained in:
Tomáš Chvátal
2020-04-23 11:56:53 +00:00
committed by Git OBS Bridge
parent e8f98c45e6
commit d6c644a4f9
3 changed files with 20 additions and 1 deletions

10
no-python2.patch Normal file
View File

@@ -0,0 +1,10 @@
Index: onnx-1.6.0/tools/protoc-gen-mypy.py
===================================================================
--- onnx-1.6.0.orig/tools/protoc-gen-mypy.py
+++ onnx-1.6.0/tools/protoc-gen-mypy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Taken from https://github.com/dropbox/mypy-protobuf/blob/d984389124eae6dbbb517f766b9266bb32171510/python/protoc-gen-mypy
# (Apache 2.0 License)

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Apr 23 11:49:13 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Force the interpreter to match the one during build
- Mypy should use python3 to generate stuff not python2
* no-python2.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Apr 23 10:35:15 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com> Thu Apr 23 10:35:15 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -27,6 +27,7 @@ URL: https://onnx.ai/
Source0: https://github.com/onnx/onnx/archive/v%{version}.tar.gz#/onnx-%{version}.tar.gz Source0: https://github.com/onnx/onnx/archive/v%{version}.tar.gz#/onnx-%{version}.tar.gz
Source1: %{name}-rpmlintrc Source1: %{name}-rpmlintrc
Patch0: protobuf.patch Patch0: protobuf.patch
Patch1: no-python2.patch
BuildRequires: %{python_module devel} BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy} BuildRequires: %{python_module numpy}
BuildRequires: %{python_module protobuf} BuildRequires: %{python_module protobuf}
@@ -59,7 +60,7 @@ community of partners.
%setup -q -n onnx-%{version} %setup -q -n onnx-%{version}
# avoid bundles # avoid bundles
rm -rf third_party rm -rf third_party
%patch0 -p1 %autopatch -p1
# say that the cmake was already built (we used our macros) # say that the cmake was already built (we used our macros)
sed -i -e 's:built = False:built = True:g' setup.py sed -i -e 's:built = False:built = True:g' setup.py
# do not require extra pytest modules # do not require extra pytest modules
@@ -79,6 +80,7 @@ sed -i -e '/pytest-runner/d' setup.py
-DBUILD_ONNX_PYTHON=ON \ -DBUILD_ONNX_PYTHON=ON \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \
-DBUILD_STATIC_LIBS=ON \ -DBUILD_STATIC_LIBS=ON \
-DPYTHON_EXECUTABLE="%{_bindir}/$python" \
-DPY_EXT_SUFFIX="`$python-config --extension-suffix`" -DPY_EXT_SUFFIX="`$python-config --extension-suffix`"
%cmake_build ; cd .. %cmake_build ; cd ..
} }