summaryrefslogtreecommitdiffstats
path: root/abs/core/python_modules/twisted/PKGBUILD
blob: ef506228d23c599c3d06b4cc68707f898fab12d3 (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
# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Juergen Hoetzel <juergen@archlinux.org>
# Contributor:  Douglas Soares de Andrade <douglas@archlinux.org>

pkgbase=twisted
pkgname=(python-twisted python2-twisted)
pkgver=17.9.0
pkgrel=1
pkgdesc="Asynchronous networking framework written in Python"
arch=('x86_64')
url="http://twistedmatrix.com/"
license=('MIT')
makedepends=('python-zope-interface' 'python2-zope-interface' 'python-setuptools'
             'python2-setuptools' 'python-service-identity' 'python2-service-identity'
             'python-incremental' 'python2-incremental' 'python-constantly' 'python2-constantly'
             'python-automat' 'python2-automat' 'python-hyperlink' 'python2-hyperlink')
checkdepends=('subversion' 'python2-sphinx' 'pygtk' 'xorg-server-xvfb' 'tk' 'openssh' 'gtk3'
              'python-gobject' 'python2-gobject' 'python-gobject2' 'python2-gobject2'
              'python2-soappy' 'python-subunit' 'python2-subunit' 'python-h2' 'python2-h2'
              'python-priority' 'python2-priority' 'python-crypto' 'python2-crypto'
              'python-cryptography' 'python2-cryptography' 'python-idna' 'python2-idna'
              'python-pyserial' 'python2-pyserial')
source=("$pkgbase-$pkgver.tar.gz::https://github.com/twisted/twisted/archive/twisted-$pkgver.tar.gz")
sha512sums=('3fb269dd928d2446e50cb5e4aa43d208d3aa7ed3902a0a7c39b8dabe9792344ad924fc500d507d34118ba2acdfd433a31aa812dd5309b01fdcb45de49e7b84ae')

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

  sed -i 's:^#!.*bin.*python:#!/usr/bin/python2:' \
    twisted-twisted-$pkgver-py2/src/twisted/mail/test/pop3testserver.py \
    twisted-twisted-$pkgver-py2/src/twisted/trial/test/scripttest.py
}

build() {
  cd "$srcdir"/twisted-twisted-$pkgver
  python setup.py build

  cd "$srcdir"/twisted-twisted-$pkgver-py2
  python2 setup.py build
}

check() {
  export LC_CTYPE=en_US.UTF-8

  cd "$srcdir"/twisted-twisted-$pkgver
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.6:$PYTHONPATH" xvfb-run python -m twisted.trial twisted

  cd "$srcdir"/twisted-twisted-$pkgver-py2
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-2.7:$PYTHONPATH" xvfb-run python2 -m twisted.trial twisted || warning "Tests failed"
}

package_python-twisted() {
  depends=('python-zope-interface' 'python-incremental' 'python-constantly' 'python-automat'
           'python-hyperlink')
  optdepends=('python-pyopenssl: for TLS client hostname verification'
              'python-service-identity: for TLS client hostname verification'
              'python-idna: for TLS client hostname verification'
              'python-cryptography: for using conch'
              'python-pyasn1: for using conch'
              'python-appdirs: for using conch'
              'python-h2: for http2 support'
              'python-priority: for http2 support'
              'python-pyserial: for serial support'
              'tk: for using tkconch')

  cd twisted-twisted-$pkgver
  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1

  # twisted in python 3 supports only few command line tools for now.
  # Let's rename the tools the other way round after the python 3 version supports all.
  for name in trial twistd twist ckeygen cftp conch pyhtmlizer tkconch; do
    mv "$pkgdir"/usr/bin/${name}{,3}
  done

  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

package_python2-twisted() {
  depends=('python2-zope-interface' 'python2-incremental' 'python2-constantly' 'python2-automat'
           'python2-hyperlink')
  optdepends=('python2-pyopenssl: for TLS client hostname verification'
              'python2-service-identity: for TLS client hostname verification'
              'python2-idna: for TLS client hostname verification'
              'python2-cryptography: for using conch'
              'python2-pyasn1: for using conch'
              'python2-appdirs: for using conch'
              'python2-h2: for http2 support'
              'python2-priority: for http2 support'
              'python2-pyserial: for serial support'
              'python2-soappy: for twisted.web.soap'
              'pygtk: for using manhole'
              'tk: for using tkconch')

  cd twisted-twisted-$pkgver-py2
  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}