summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a96cd1cb1a4ca8a3d0e505b2ecc2c974199043ac (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
# $Id$
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Fabio Volpe <volpefabio@gmail.com>

pkgbase=python-sphinx
pkgname=('python-sphinx' 'python2-sphinx')
pkgver=1.1.3
pkgrel=3
arch=('any')
url='http://sphinx.pocoo.org/'
license=('GPL')
makedepends=(
  'python-distribute'
  'python-docutils'
  'python-jinja'
  'python-pygments'
  'python2-distribute'
  'python2-docutils'
  'python2-jinja'
  'python2-pygments'
)
checkdepends=(
  'python-nose'
  'python2-nose'
  'texlive-latexextra'
)
source=("http://pypi.python.org/packages/source/S/Sphinx/Sphinx-$pkgver.tar.gz")
md5sums=('8f55a6d4f87fc6d528120c5d1f983e98')

build() {
  cd Sphinx-$pkgver
  # remove build directory (avoid sed issues)
  [[ -e build ]] && rm -rf build
  # python builds
  python setup.py build --build-lib=build/python
  python2 setup.py build --build-lib=build/python2
  # change python2 interpreter
  find build/python2 -type f -exec \
    sed -i '1s,^#! \?/usr/bin/\(env \|\)python$,#!/usr/bin/python2,' {} \;
  # change sphinx-binaries name in source code
  find build/python2 -type f -name '*.py' -exec \
    sed -ri 's,(sphinx-(:?build|apidoc|autogen|quickstart)),\12,' {} \;
}

check() {
  #(cd Sphinx-$pkgver/build/python/ && python ../../tests/run.py -d)
  (cd Sphinx-$pkgver/build/python2/ && python2 ../../tests/run.py -d)
}

package_python-sphinx() {
  pkgdesc='Python3 documentation generator'
  depends=('python-jinja' 'python-pygments' 'python-docutils')
  optdepends=('texlive-latexextra: for generation of PDF documentation')

  cd Sphinx-$pkgver
  python setup.py build --build-lib=build/python \
                  install --root="$pkgdir" --optimize=1
}

package_python2-sphinx() {
  pkgdesc='Python2 documentation generator'
  depends=('python2-jinja' 'python2-pygments' 'python2-docutils')
  optdepends=('texlive-latexextra: for generation of PDF documentation')

  cd Sphinx-$pkgver
  python2 setup.py build --build-lib=build/python2 \
                   install --root="$pkgdir" --optimize=1
  # fix python3 conflict
  for _f in "$pkgdir"/usr/bin/*; do
      mv -v "$_f" "${_f}2"
  done
}

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