summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 80c9a053e1a58ff28efabc39b45277e8c63e6ecc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Maintainer: Butui Hu <hot123tea123@gmail.com>

pkgname=python-onnx
pkgver=1.6.0
pkgrel=8
pkgdesc='Open Neural Network Exchange'
arch=('x86_64')
url='https://onnx.ai'
license=('MIT')
depends=(
  'protobuf'
  'python-protobuf'
  'python-numpy'
  'python-six'
  'python-typing_extensions'
)
makedepends=(
  'cmake'
  'git'
  'python-setuptools'
)
checkdepends=(
  'python-nbval' 
  'python-nose' 
  'python-pytest' 
  'python-scipy'
  ${optdepends[@]}
)
optdepends=(
  'mxnet'
  'python-pytorch'
  'python-tensorflow'
)
source=("${pkgname}::git+https://github.com/onnx/onnx.git#tag=v${pkgver}")
sha512sums=('SKIP')

get_pyver() {
  python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
}

prepare() {
  cd "${srcdir}/${pkgname}"
  git submodule update --init --recursive
  # fix build with protobuf 3.11, see https://github.com/onnx/onnx/pull/2482/files
  sed -i 's/${ONNX_DLLEXPORT_STR}${CMAKE_CURRENT_BINARY_DIR})/${CMAKE_CURRENT_BINARY_DIR})/' "${srcdir}/${pkgname}/CMakeLists.txt"
}

build() {
  cd "${pkgname}"
  python setup.py build
}

check() {
  cd "${srcdir}/${pkgname}"
  PYTHONPATH="${PWD}/build/lib.linux-${CARCH}-$(get_pyver)" pytest -v
}

package() {
  cd "${pkgname}"
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
# vim:set ts=2 sw=2 et: