summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 16662e0a12f910890c39a9a2e86a0a54da90ffc8 (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
# Maintainer: Matthew McGinn <mamcgi@gmail.com>
pkgname=('python2-docker-py-git')
_srcname='docker-py'
pkgver=r2640.1533861202.e78e4e74
pkgrel=1
pkgdesc='An API client for docker written in Python'
arch=('any')
url="https://github.com/docker/${_srcname}"
license=('Apache')

depends=(
    'python2'
    'python2-six'
    'python2-requests'
    'python2-websocket-client'
)
makedepends=('git' 'python2-setuptools')
provides=("${pkgname[0]%-git}")
conflicts=("${pkgname[0]%-git}")

source=("${_srcname}::git+${url}.git")
sha512sums=('SKIP')

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

  # Patch any #!/usr/bin/python to #!/usr/bin/python2
  for file in $(find . -name '*.py' -print); do
    sed -r -i 's_^#!.*/usr/bin/python(\s|$)_#!/usr/bin/python2_' $file
    sed -r -i 's_^#!.*/usr/bin/env(\s)*python(\s|$)_#!/usr/bin/env python2_' $file
  done

  python2 setup.py build
}

pkgver() {
    cd "${srcdir}/${_srcname}"

    printf 'r%s.%s.%s\n' \
        "$( git rev-list --count 'HEAD' )" \
        "$( git log --max-count='1' --pretty='format:%ct' )" \
        "$( git rev-parse --short 'HEAD' )"
}

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

    python2 setup.py install --root="${pkgdir}" --optimize=1
}