summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 48f326f96101a0f51500abc948798fd13e9a721f (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
# Maintainer: Astro Benzene <universebenzene at sina dot com>

pkgbase=python-runnotebook-git
_gitname=RunNotebook
_pname=runnotebook
pkgname=("python-${_pname}-git" "python-${_pname}-example-git")
pkgver=0.3.1.r7.g20ce2a7
pkgrel=1
pkgdesc="IPython notebook sphinx extensions"
arch=('any')
url="https://github.com/ngoldbaum/RunNotebook"
license=('BSD')
makedepends=('git'
             'python-setuptools'
             'python-wheel'
             'python-build'
             'python-installer'
             'python-sphinx'
             'python-sphinx-bootstrap-theme'
             'jupyter-nbformat'
             'jupyter-nbconvert'
             'python-matplotlib'
             'python-sympy')
checkdepends=('python-nose')
source=("git+https://github.com/ngoldbaum/RunNotebook")
md5sums=('SKIP')

pkgver() {
    cd "${srcdir}/${_gitname}"

    ( set -o pipefail
      git describe --long --tags 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
      printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
    )
}

prepare() {
    cd ${srcdir}/${_gitname}/example/source

    sed -i "/sym.numbers.Number/s/sym.numbers/sym.core.numbers/" SymPy.ipynb
}

build() {
    cd ${srcdir}/${_gitname}
    python -m build --wheel --no-isolation
#   python setup.py build

    msg "Building Examples"
    cd ${srcdir}/${_gitname}/example
    PYTHONPATH="../build/lib" make html
}

check() {
    cd ${srcdir}/${_gitname}

    nosetests
}

package_python-runnotebook-git() {
    depends=('python-sphinx'
             'jupyter-notebook'
             'python-qtconsole'
             'jupyter_console'
             'jupyter-nbconvert'
             'python-ipykernel'
             'python-ipywidgets'
             'jupyter-nbformat')
    optdepends=('python-runnotebook-example: example documentation')
    provides=("${pkgname%-git}")
    conflicts=("${pkgname%-git}")
    cd ${srcdir}/${_gitname}

    install -D -m644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
    install -D -m644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
    python -m installer --destdir="${pkgdir}" dist/*.whl
#   python setup.py install --root=${pkgdir} --prefix=/usr --optimize=1
}

package_python-runnotebook-example-git() {
    pkgdesc="RunNotebook example documentation"
    provides=("${pkgname%-git}")
    conflicts=("${pkgname%-git}")
    cd ${srcdir}/${_gitname}/example/build

    install -D -m644 -t "${pkgdir}/usr/share/licenses/${pkgname}" ../../LICENSE
    install -d -m755 "${pkgdir}/usr/share/doc/${pkgbase}"
    cp -a html "${pkgdir}/usr/share/doc/${pkgbase}"
}