summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 255cccf2a6a902b968c341374e7654bbdc0042ba (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Maintainer: derieck

_pkgname='nmeasim-python'
pkgname="${_pkgname}-git"
epoch=0
pkgver=1.1.1.0.r33.20230911.ba46ca8
pkgrel=1
pkgdesc='A Python 3 GNSS/NMEA receiver simulation, with GUI.'
arch=(
  any
)
url='https://gitlab.com/nmeasim/nmeasim'
license=('custom: Public Domain')
depends=(
  'python>=3.8'
  'python-geographiclib'
  # 'python-importlib-metadata' That is needed for python < 3.8.
  'python-pyserial'
  'tk'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools>=61.2'
  'python-setuptools-scm>=3.4.3'
  'python-wheel'
  # 'python-setuptools'
)
optdepends=()
provides=(
  "${_pkgname}=${pkgver}"
  "python-nmeasim=${pkgver}"
  "python-nmeasim-git=${pkgver}"
)
conflicts=(
  "${_pkgname}"
  'python-nmeasim'
)
replaces=()
source=(
  "${_pkgname}::git+https://gitlab.com/nmeasim/nmeasim.git"
)
sha256sums=(
  'SKIP'
)

# prepare() {
#   cd "${srcdir}/${_pkgname}"
# }

pkgver () {
  cd "${srcdir}/${_pkgname}"
  _ver="$(git describe  --tags | sed 's|^v||' | sed 's|-[^-]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${srcdir}/${_pkgname}"

  python -m build --wheel --no-isolation
  # python setup.py build
}

# check() {
#   cd "${srcdir}/${_pkgname}"
# 
#  python setup.py test
# }

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

  export PYTHONHASHSEED=0
  python -m installer --destdir="${pkgdir}" dist/*.whl
  # python setup.py install --root="${pkgdir}" --optimize=1 --skip-build

  #local _pyver="$(python -V | awk '{print $2}' | awk -F. '{print $1"."$2}')"
  #install -D -v -m644 nmeasim/icon.ico "${pkgdir}/usr/lib/python${_pyver}/site-packages/nmeasim/icon.ico"

  mv -v "${pkgdir}/usr/bin/nmeasim" "${pkgdir}/usr/bin/nmeasim-python" # Renaming it, because there is also Java-nmeasim (https://github.com/abuech2s/nmeasim) and a Windows-nmeasim (https://sourceforge.net/projects/nmeasim/), which might be worth to have as Arch Linux packages as well.

  install -D -v -m644 nmeasim/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  for _docfile in readme.md; do
    install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done
  ln -svf "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE"
}