summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 425c699a100818c1a7287df10a67903e9879f829 (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
# $Id$
# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
# Contributor: SĂ©bastien Luttringer
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Fabio Volpe <volpefabio@gmail.com>

pkgbase=python-sphinx
pkgname=('python-sphinx' 'python2-sphinx')
pkgver=1.4.4
pkgrel=1

arch=('any')
url='http://sphinx.pocoo.org/'
license=('BSD')

makedepends=(
  'python-setuptools'
  'python-docutils'
  'python-jinja'
  'python-pygments'
  'python-six'
  'python-imagesize'
  'python2-setuptools'
  'python2-docutils'
  'python2-jinja'
  'python2-pygments'
  'python2-six'
  'python2-imagesize'
)

checkdepends=(
  'python-nose' 'python2-nose'
  'texlive-latexextra'
  'python-snowballstemmer' 'python2-snowballstemmer'
  'python-babel' 'python2-babel'
  'python-sphinx-alabaster-theme' 'python2-sphinx-alabaster-theme'
  'python-sphinx_rtd_theme' 'python2-sphinx_rtd_theme'
  'python2-mock'
)

source=("https://files.pythonhosted.org/packages/source/S/Sphinx/Sphinx-$pkgver.tar.gz")

md5sums=('64ce2ec08d37ed56313a98232cbe2aee')

prepare() {
  # souce duplication is required because makefile modify source code
  # setyp.py --build tricks don't works well
  cp -a Sphinx-$pkgver Sphinx-${pkgver}2
  # change python2 interpreter
  find Sphinx-${pkgver}2 -type f -exec \
    sed -i '1s,^#! \?/usr/bin/\(env \|\)python$,#!/usr/bin/python2,' {} \;
  # change sphinx-binaries name in source code
  find Sphinx-${pkgver}2 -type f -name '*.py' -exec \
    sed -ri 's,(sphinx-(:?build|apidoc|autogen|quickstart)),\12,' {} \;
}

build() {
  msg2 'Python 3 version'
  cd "$srcdir"/Sphinx-$pkgver
  make PYTHON=python3 build

  msg2 'Python 2 version'
  cd "$srcdir"/Sphinx-${pkgver}2
  make PYTHON=python2 build
}

check() {
  msg2 'Python 3 version'
  cd "$srcdir"/Sphinx-$pkgver
#  make PYTHON=python3 test
  rm -r tests

  msg2 'Python 2 version'
  cd "$srcdir"/Sphinx-${pkgver}2
#  make PYTHON=python2 test
  rm -r tests
}

package_python-sphinx() {
  pkgdesc='Python3 documentation generator'
  depends=(
    'python-jinja'
    'python-pygments'
    'python-docutils'
    'python-sphinx_rtd_theme'
    'python-sphinx-alabaster-theme'
    'python-babel'
    'python-snowballstemmer'
    'python-six'
    'python-imagesize'
  )
  optdepends=('texlive-latexextra: for generation of PDF documentation')

  cd Sphinx-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 "$srcdir"/Sphinx-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/python-sphinx/LICENSE
}

package_python2-sphinx() {
  pkgdesc='Python2 documentation generator'
  depends=(
    'python2-jinja'
    'python2-pygments'
    'python2-docutils'
    'python2-sphinx_rtd_theme'
    'python2-sphinx-alabaster-theme'
    'python2-babel'
    'python2-snowballstemmer'
    'python2-six'
    'python2-imagesize'
  )
  optdepends=('texlive-latexextra: for generation of PDF documentation')

  cd Sphinx-${pkgver}2
  python2 setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 "$srcdir"/Sphinx-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/python2-sphinx/LICENSE
}

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