summaryrefslogtreecommitdiffstats
path: root/abs/core/python_modules/docutils/PKGBUILD
blob: 1b7cbe6b55ce18221a4f8d133158e8225f7128cf (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
# $Id$
# Maintainer: Sébastien Luttringer
# Contributor : Ionut Biru <ibiru@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgbase=docutils
pkgname=('python-docutils' 'python2-docutils')
pkgver=0.14
pkgrel=1
pkgdesc='Set of tools for processing plaintext docs into formats such as HTML, XML, or LaTeX'
arch=('any')
url='http://docutils.sourceforge.net'
license=('custom')
makedepends=('python' 'python2')
source=("http://downloads.sourceforge.net/$pkgbase/$pkgbase-$pkgver.tar.gz")
md5sums=('c53768d63db3873b7d452833553469de')

build() {
  cd $pkgbase-$pkgver
  msg2 python3
  python3 setup.py build --build-lib=build/python
  find build/python -type f -exec \
    sed -i '1s,^#! \?/usr/bin/\(env \|\)python$,#!/usr/bin/python3,' {} \;
  msg2 python2
  python2 setup.py build --build-lib=build/python2
  find build/python2 -type f -exec \
    sed -i '1s,^#! \?/usr/bin/\(env \|\)python$,#!/usr/bin/python2,' {} \;
}

check() {
  cd $pkgbase-$pkgver
  # we need utf locale to valid utf8 tests
  export LANG=en_US.UTF-8
  # Disable python3 check
  #msg2 'python checks'
  #PYTHONPATH="$PWD/build/python/" python3 test3/alltests.py
  msg2 'python2 checks'
  PYTHONPATH="$PWD/build/python2/" python2 test/alltests.py
}

package_python-docutils() {
  depends=('python')

  cd $pkgbase-$pkgver
  python setup.py build --build-lib=build/python \
                  install --root="$pkgdir" --optimize=1
  # symlink without .py
  for f in "$pkgdir"/usr/bin/*.py; do
      ln -s "$(basename $f)" "$pkgdir/usr/bin/$(basename $f .py)"
  done
  # setup license
  install -D -m644 COPYING.txt "$pkgdir/usr/share/licenses/$pkgname/COPYING.txt"
  install -D -m644 licenses/python* "$pkgdir/usr/share/licenses/$pkgname/"
}

package_python2-docutils() {
  depends=('python2')
  provides=("docutils=$pkgver")
  replaces=('docutils')
  install=python2-docutils.install

  cd $pkgbase-$pkgver
  python2 setup.py build --build-lib=build/python2 \
                   install --root="$pkgdir" --optimize=1
  # fix python-docutils conflict
  for _f in "$pkgdir"/usr/bin/*.py; do
      mv -v "$_f" "${_f%.py}2.py"
  done
  # symlink without .py
  for _f in "$pkgdir"/usr/bin/*.py; do
      ln -s "$(basename $_f)" "$pkgdir/usr/bin/$(basename $_f .py)"
  done
  # setup license
  install -D -m644 COPYING.txt "$pkgdir/usr/share/licenses/$pkgname/COPYING.txt"
  install -D -m644 licenses/python* "$pkgdir/usr/share/licenses/$pkgname/"
}

# vim:set ts=2 sw=2 et: