summaryrefslogtreecommitdiff
path: root/python-oauth2/PKGBUILD
blob: b2477fc58cc66e5915a02f4033365c80f553b6ab (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
# Maintainer: Erich Eckner <arch at eckner dot net>
pkgbase=python-oauth2
pkgname=(python-oauth2 python2-oauth2)
pkgver=1.9
pkgrel=1
pkgdesc='library for OAuth'
url='https://pypi.python.org/pypi/oauth2/'
arch=('any')
license=('MIT')
_depends=()
_optdepends=()
makedepends=(
  'python' 'python2' 'python-setuptools' 'python2-setuptools'
  "${_depends[@]}"
  "${_depends[@]/python/python2}"
)
source=("https://github.com/joestump/python-oauth2/archive/v${pkgver}.tar.gz")
sha512sums=('ba3183aa4e5512920fa540955321646c167d23dfd4bc2fad4d5426e1b71e35e91fe11f6cd919a7913015f9bf33c43849659cb97c862a57b5c2e288ace29ad452')

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

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

check() {
  msg2 "Checking python..."
  (
    cd python-oauth2-${pkgver}
    python setup.py test
  )
  msg2 "Checking python2..."
  (
    cd python-oauth2-${pkgver}-py2
    python2 setup.py test
  )
}

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

  cd python-oauth2-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build
  install -Dm 644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}
}

package_python2-oauth2() {
  _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-oauth2-${pkgver}-py2
  python2 setup.py install --prefix=/usr --root="${pkgdir}" --skip-build
  install -Dm 644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}
}