summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 238abfc62e71ace17b0b849a8cd325427a60ee7d (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
# Maintainer: Lennard Hofmann <lennard dot hofmann at web dot de>
# Contributor: Lahfa Samy (AkechiShiro) <'akechishiro-aur' at the domain 'lahfa.xyz'>
# Contributor: Aaron McDaniel (mcd1992) <'aur' at the domain 'fgthou.se'>
pkgname=python-pwntools-git
pkgver=4.15.0.r124.gee49a2be
pkgrel=1
pkgdesc='A CTF framework and exploit development library'
url='https://github.com/Gallopsled/pwntools'
arch=('any')
license=('BSD-2-Clause AND GPL-2.0-or-later AND GPL-3.0-or-later AND MIT')
makedepends=(
  'git'
  'python-build'
  'python-installer'
)
conflicts=('python-pwntools')
depends=(
  'python'
  'python-capstone'
  'python-colored-traceback'
  'python-intervaltree'
  'python-mako'
  'python-packaging'
  'python-paramiko'
  'python-psutil'
  'python-pyelftools'
  'python-pygments'
  'python-pyserial'
  'python-pysocks'
  'python-requests'
  'python-rpyc'
  'python-sortedcontainers'
  'python-unicorn'
  'python-zstandard'
  'ropgadget'
)
optdepends=('gdb: binary debugging'
            'python-dateutil: Android build date fallback parsing')
source=("${pkgname}::git+https://github.com/Gallopsled/pwntools.git#branch=dev")
sha256sums=('SKIP')
provides=('python-pwntools')

pkgver() {
  cd ${pkgname}
  # Remove 'v' prefix on tags; prefix revision with 'r'; replace all '-' with '.'
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd ${pkgname}
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd ${pkgname}
  python -m installer --destdir=test_dir dist/*.whl

  PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH" PWNLIB_NOTERM=true python -c 'import pwn'
}

package() {
  cd ${pkgname}
  python -m installer --destdir="${pkgdir}" dist/*.whl
  find "${pkgdir}/usr/bin" -type f ! -name pwn -delete

  install -Dm 644 LICENSE-pwntools.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"

  # https://github.com/Gallopsled/pwntools/issues/2150
  install -d "${pkgdir}/usr/share/doc/"
  mv -v "${pkgdir}/usr/pwntools-doc" "${pkgdir}/usr/share/doc/"

  install -Dm 644 extra/bash_completion.d/pwn -t  "${pkgdir}/usr/share/bash-completion/completions/"
  install -Dm 644 extra/zsh_completion/_pwn -t "${pkgdir}/usr/share/zsh/site-functions/"

  install -Dm 644 LICENSE-pwntools.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}