summarylogtreecommitdiffstats
path: root/geninfo.sh
blob: 5e1ee5d38017db659c72331cc5259838397c0181 (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
#!/usr/bin/env bash

## run './geninfo.sh' after run 'updpkgsums'

_pkgname=$(awk -F= '/_pkgname=/{print $2}' PKGBUILD)
_pipname="${_pkgname//-/_}"
pkgver=$(awk -F= '/pkgver=/{print $2}' PKGBUILD)
pysetup="src/${_pipname}-${pkgver}/setup.py"

makepkg -do
depends=$(awk '/requirements *= *\[/,/^\]/' "$pysetup" |
    sed '1s/.*\[//; $s/\].*//' |
    grep -v "^\s*#" |
    sed 's|,||g' |
    sed '/^$/d' |
    sed 's|\s||g' | 
    sed 's|"||g' |
    sed "s|'||g" |
    grep -oP '^([a-zA-Z0-9_-]+)' |
    tr 'A-Z' 'a-z' |
    sed 's|^|python-|' |
    sed 's|python-python-|python-|' |
    sed '/^python-python$/d' |
    sed 's|python-cython|cython|' |
    sort -u |
    tr '\n' ' ' |
    sed 's| $||'
)

sed -e "s|^depends=.*|depends=(${depends})|" -i PKGBUILD