summaryrefslogtreecommitdiff
path: root/python-memcached/PKGBUILD
blob: 40ffa3b619913c259056ff89be1f3f76c33acd30 (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
# Maintainer: Erich Eckner <arch at eckner dot net>
pkgbase=python-memcached
pkgname=(python-memcached python2-memcached)
pkgver=1.59
pkgrel=1
pkgdesc='100% Python interface to the memcached memory cache daemon'
url='https://github.com/linsomniac/python-memcached'
arch=('any')
license=('MIT')
_depends=(
  'python-six>=1.4.0'
)
_mdepends=(
  'python'
  'python-nose'
  'python-coverage'
  'python-hacking'
)
_cdepends=(
  'python-mock'
  'python-nose'
  'python-coverage'
  'python-hacking'
  'memcached'
)
_optdepends=(
  'python-memcached'
  'python-pymongo'
  'python-redis'
)
makedepends=(
  "${_depends[@]}"
  "${_depends[@]/python/python2}"
  "${_mdepends[@]}"
  "${_mdepends[@]/python/python2}"
)
checkdepends=(
  "${_cdepends[@]}"
  "${_cdepends[@]/python/python2}"
)
source=("https://github.com/linsomniac/python-memcached/archive/${pkgver}.tar.gz")
sha512sums=('d7ff45a329f2a9bf97fdc7c0268c2c67046c3501270fcf03578b955c2da35904d7bdecd4239924d390797ddff8f4cc69fc5743f4d4f663cdb9f2f8c7e8159512')

prepare() {
  cp -a python-memcached-${pkgver}{,-py2}
}

build() {
  msg2 "Building python..."
  (
    cd python-memcached-${pkgver}
    python setup.py build
  )
  msg2 "Building python2..."
  (
    cd python-memcached-${pkgver}-py2
    python2 setup.py build
  )
}

check() {
  msg2 "starting memcached ..."
  memcached -l 127.0.0.1 -o modern &
  _memcached_pid=$!
  sleep 1
  msg2 "Checking python..."
  (
    cd python-memcached-${pkgver}
    python setup.py test
  )
  msg2 "Checking python2..."
  (
    cd python-memcached-${pkgver}-py2
    python2 setup.py test
  )
  msg2 "killing memcached ..."
  kill ${_memcached_pid}
}

package_python-memcached() {
  _pyVer=$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f2)
  depends=(
    "python>=3.${_pyVer}"
    "python<3.$((_pyVer+1))"
    "${_depends[@]}"
  )
  optdepends=("${_optdepends[@]}")

  cd python-memcached-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build
}

package_python2-memcached() {
  _pyVer=$(python2 -V 2>&1 | cut -d' ' -f2 | cut -d. -f2)
  depends=(
    "python2>=2.${_pyVer}"
    "python2<2.$((_pyVer+1))"
    "${_depends[@]}"
    "${_depends[@]/python/python2}"
  )
  optdepends=("${_optdepends[@]/python/python2}")

  cd python-memcached-${pkgver}-py2
  python2 setup.py install --prefix=/usr --root="${pkgdir}" --skip-build
}