summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 74370f33e57da2f80976291704228d1ebe98bbfc (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
# Maintainer:  Vitalii Kuzhdin <vitaliikuzhdin@gmail.com>

_name="mtable"
_pkgname="python-${_name}"
pkgname="${_pkgname}-git"
pkgver=0.1.22.r1.b893750
_commit="97f59245683a1a20fc19595298485535bc1bc9ec"
pkgrel=1
pkgdesc="Format data to reStructedText and Markup Table"
arch=('any')
url="https://github.com/liuyug/${_name}"
license=('custom:BSD-?-Clause')
makedepends=('git' 'python-build' 'python-installer' 'python-wheel'
             'python-setuptools')
# testdepends=('python-chardet')
depends=('python' 'python-wcwidth' 'python-beautifulsoup4' 'python-pandas')
provides=("${_pkgname}=${pkgver%%.r*}")
conflicts=("${_pkgname}")
_pkgsrc="${_name}"
source=("${_pkgsrc}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
  cd "${_pkgsrc}"
  # git describe --long --tags --abbrev=7 | sed 's/v//;s/\([^-]*-g\)/r\1/;s/-/./g'
  local rev_count=$(git rev-list --count "${_commit}..HEAD")
  local short_hash=$(git rev-parse --short=7 HEAD)

  cd "${srcdir}/${_pkgsrc}"
  local version=$(sed -n "s/.*VERSION = '\([^']*\)'.*/\1/p" "${_name}.py")

  printf "%s.r%s.%s" "${version}" "${rev_count}" "${short_hash}"
}

prepare() {
  git -C "${srcdir}/${_pkgsrc}" clean -dfx
}

build() {
  cd "${srcdir}/${_pkgsrc}"
  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_pkgsrc}"
  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -Dm644 "README.rst" "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
  # install -Dm644 "LICENSE"    "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}