summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 35715d1323e8c5c029c542df952b363f802b258d (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# SPDX-License-Identifier: AGPL-3.0
#
# Maintainer:  Pellegrino Prevete <cGVsbGVncmlub3ByZXZldGVAZ21haWwuY29tCg== | base -d>
# Maintainer:  Truocolo <truocolo@aol.com>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >

_py="python2"
_pkg="tornado"
_proj="${_pkg}web"
pkgname="${_py}-${_pkg}"
pkgver=5.1.1
pkgrel=3
_pkgdesc=(
  'open source version of the scalable,'
  'non-blocking web server and tools'
)
pkgdesc="${_pkgdesc[*]}"
arch=(
  'x86_64'
  'i686'
  'pentium4'
  'arm'
  'armv7h'
  'aarch64'
  'mips'
)
url="https://www.${_proj}.org"
license=(
  'Apache'
)
depends=(
  "${_py}-futures"
  "${_py}-singledispatch"
  "${_py}-backports-abc"
)
optdepends=(
  "${_py}-monotonic: enable support for a monotonic clock"
  "${_py}-pycurl: for ${_pkg}.curl_httpclient"
  "${_py}-twisted: for ${_pkg}.platform.twisted"
  # "${_py}-pycares: an alternative non-blocking DNS resolver"
)
makedepends=(
  "${_py}-setuptools"
)
checkdepends=(
  "${_py}-pycurl"
  "${_py}-mock"
  "${_py}-twisted"
  "${_py}-trollius"
  "${_py}-monotonic"
)
provides=(
  "${_pkg}=${pkgver}"
  "${_pkg}2=${pkgver}"
)
conflicts=(
  "${_pkg}=${pkgver}"
  "${_pkg}2=${pkgver}"
)
_ns="${_proj}"
_http="https://github.com"
source=(
  "$pkgname-$pkgver.tar.gz::${_http}/${_ns}/${_pkg}/archive/v${pkgver}.tar.gz"
)
sha512sums=(
  'b35fa0687ede6e672c35ca82fcc01dbb2ae9d8a7f2e4a65b6e07aa5a8eca861a22d775101172b7e33564951d193e5f11887021a3d762bee88668b9ac0069ab46'
)

export \
  TORNADO_EXTENSION=1

prepare() {
  # python -> python2 rename
  find \
    "${_pkg}-${pkgver}" \
    -name '*py' \
    -exec \
      sed \
        -e 's_#!/usr/bin/env python_&2_' \
        -i \
        {} \;
}

build() {
  cd \
    "${_pkg}-${pkgver}"
  "${_py}" \
    setup.py \
      build
}

check() {
  # As of 4.5.3, ignoring test failures about resolving "localhost"
  (
    cd \
      "${_pkg}-${pkgver}"
    "${_py}" \
      setup.py \
        install \
          --root="$PWD/tmp_install" \
          --optimize=1
    export \
      PYTHONPATH="$PWD/tmp_install/usr/lib/python2.7/site-packages:$PYTHONPATH"
    cd tmp_install
    "${_py}" \
      -m \
        "${_pkg}.test.runtests"
    "${_py}" \
      -m \
        "${_pkg}.test.runtests" \
        --ioloop="${_pkg}.platform.select.SelectIOLoop"
    "${_py}" \
      -m \
        "${_pkg}.test.runtests" \
        --httpclient="${_pkg}.curl_httpclient.CurlAsyncHTTPClient"
    "${_py}" \
      -m \
        "${_pkg}.test.runtests" \
      --ioloop_time_monotonic
    "${_py}" \
      -m \
        "${_pkg}.test.runtests" \
      --ioloop="${_pkg}tornado.platform.twisted.TwistedIOLoop"
    "${_py}" \
      -m \
        "${_pkg}.test.runtests" \
        --ioloop="${_pkg}.platform.asyncio.AsyncIOLoop"
    "${_py}" \
      -m \
        "${_pkg}.test.runtests" \
        --resolver="${_pkg}.netutil.ThreadedResolver"
  ) || \
    echo \
      "Tests failed"
}

package() {
  cd "${_pkg}-${pkgver}"
  "${_py}" \
    setup.py \
      install \
        --root="${pkgdir}" \
        --optimize=1
}

# vim:set sw=2 sts=-1 et: