summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 27c5ca3a0f9786073f13f2ec336d15629c063661 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: dreieck

_pymodule="mtcnn"
_pkgname="python-${_pymodule}"
pkgname="${_pkgname}-git"
pkgdesc="Implementation of the MTCNN face detector for Keras. Written from scratch, using as a reference the implementation of MTCNN from David Sandberg (FaceNet’s MTCNN) in Facenet. Based on the paper Zhang, K et al. (2016)"
# url="https://pypi.org/project/mtcnn/"
url="http://github.com/ipazc/mtcnn"
license=("MIT")
epoch=0
pkgver=1.0.0+r62.20241008.14c9b05
pkgrel=1
arch=(
  'any'
)
depends=(
  'python>=3.4'
  'python-keras'
  'python-opencv'
  'python-tensorflow>=2.2'
)
makedepends=(
  'git'
  'python-setuptools'
)
provides=(
  "${_pkgname}=${pkgver}"
  "python3-${_pymodule}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  "python3-${_pymodule}"
)
optdepends=()
source=(
  "${_pymodule}::git+https://github.com/ipazc/mtcnn.git"
)
sha256sums=(
  'SKIP'
)
validpgpkeys=()


pkgver() {
  cd "${srcdir}/${_pymodule}"
  _ver="$(grep -E '^[[:space:]]*__version__[[:space:]]*=' mtcnn/metadata.py | awk -F= '{print $2}' | tr -d "[[:space:]]\"'")"
  _rev="$(git rev-list HEAD --count)"
  _date="$(git log -1 --format=%cd --date=format:%Y%m%d)"
  _hash="$(git rev-parse --short HEAD)"
  if [ -z ${_ver} ]; then
    error "Could not determine version."
    exit 1
  else
    printf '%s' "${_ver}+r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${srcdir}/${_pymodule}"
  printf '%s\n' "${url}" > "upstream.url"

  python setup.py build
}

package() {
  cd "${srcdir}/${_pymodule}"

  ## See https://wiki.archlinux.org/title/Python_package_guidelines#Reproducible_bytecode
  export PYTHONHASHSEED=0

  python setup.py install --root="$pkgdir" --optimize=1 --skip-build

  for _docfile in AUTHORS README.rst requirements.txt example.py example.ipynb upstream.url; do
    install -D -m644 -v "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done

  for _license in "LICENSE"; do
    install -D -m644 -v "${_license}" "${pkgdir}/usr/share/licenses/${pkgname}/${_license}"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/${_license}" "${pkgdir}/usr/share/doc/${_pkgname}/${_license}"
  done
}