summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: de0250b4faf399dc2efc6a64fe1d866259ae28ee (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Maintainer: GI_Jack <GI_Jack@hackermail.com>
# Contributor: dreieck (https://aur.archlinux.org/account/dreieck)

_pyname="arc4"
_projectname="${_pyname}"
_pkgname="python-${_projectname}"
pkgname="${_pkgname}"
pkgver=0.4.0
pkgrel=1
pkgdesc="A small and insanely fast ARCFOUR (RC4) cipher implementation for Python."
arch=(
  'aarch64'
  'armv6h'
  'armv7h'
  'armv8h'
  'i686'
  'x86_64'
)
_gitprotocol='git+https'
_githost='github.com'
_gituser='manicmaniac'
_giturl="${_githost}/${_gituser}/${_projectname}.git"
url="https://${_githost}/${_gituser}/${_projectname}"
license=("custom: MIT")
depends=(
  'glibc'
  'python>=3.7'
)
makedepends=(
  'cython'
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
  'python-mock'
  'python-sphinx'
)
provides=("${_pkgname}-git=${pkgver}")
conflicts=("${_pkgname}-git")

source=(
  "${_pkgname}::${_gitprotocol}://${_giturl}#tag=${pkgver}"
)
sha256sums=(
  'SKIP'
)

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

  git log > "${srcdir}/git.log"
}

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

  printf '%s\n' " --> building ..."
  python -m build --wheel --no-isolation

  printf '%s\n' " --> making documentation ..."
  cd docs
  make man
  make text
  make html
  make qthelp
  gzip -9 _build/man/*
}

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

  printf '%s\n' " --> installing ..."
  python -m installer --destdir="$pkgdir" --compile-bytecode=2 dist/*.whl

  _docfiles=(
    "${srcdir}/git.log"
    README.rst
  )
  _docdirs=(
    docs/_build/html
    docs/_build/qthelp
    docs/_build/text
  )
  _manfiles=(
    docs/_build/man/arc4.1.gz
  )
  _infofiles=()
  _licensefiles=(
    LICENSE
  )
  printf '%s\n' " --> installing documentation ..."
  for _docfile in "${_docfiles[@]}"; do
    install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/$(basename "${_docfile}")"
  done
  for _docdir in "${_docdirs[@]}"; do
    cp -rv "${_docdir}" "${pkgdir}/usr/share/doc/${_pkgname}/$(basename "${_docdir}")"
  done
  for _manfile in "${_manfiles[@]}"; do
    _section="$(basename "${_manfile}" .gz | sed -E -e 's|^.*\.([^.]*)$|\1|')"
    install -D -v -m644 "${_manfile}" "${pkgdir}/usr/share/man/man${_section}/$(basename "${_manfile}")"
  done
  for _infofile in "${_infofiles[@]}"; do
    install -D -v -m644 "${_infofile}" "${pkgdir}/usr/share/info/$(basename "${_infofile}")"
  done
  printf '%s\n' " --> installing license ..."
  for _licensefile in "${_licensefiles[@]}"; do
    install -D -v -m644 "${_licensefile}" "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_licensefile}")"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_licensefile}")" "${pkgdir}/usr/share/doc/${_pkgname}/$(basename "${_licensefile}")"
  done
}