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

pkgbase=python-sphinx-collections
_pyname=${pkgbase#python-}
pkgname=("python-${_pyname}"  "python-${_pyname}-doc")
pkgver=0.2.0
#_commit="37b54c0a78e1772aabe13634ea2e2211749ac865"
pkgrel=1
pkgdesc="Sphinx extension for collecting external data for Sphinx build"
arch=('any')
url="https://sphinx-collections.readthedocs.io"
license=('BSD-3-Clause')
makedepends=('python-poetry-core'
             'python-build'
             'python-installer'
             'python-sphinx'
             'python-gitpython'
             'python-setuptools')
#checkdepends=('python-pytest'
##             'python-pytest-xdist'
#              'git'
#)    # sphinx
#source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
source=("https://github.com/useblocks/sphinx-collections/archive/refs/tags/${pkgver}.tar.gz")
#source=("https://github.com/useblocks/sphinx-collections/archive/${_commit}.tar.gz")
md5sums=('b866584729f8676ebf237fe8bf335cd2')

get_pyinfo() {
    [[ $1 == "site" ]] && python -c "import site; print(site.getsitepackages()[0])" || \
        python -c "import sys; print('$1'.join(map(str, sys.version_info[:2])))"
}

prepare() {
    cd ${srcdir}/${_pyname}-${pkgver}

    sed -i "s/0.0.2/${pkgver}/" pyproject.toml
}

build() {
    cd ${srcdir}/${_pyname}-${pkgver}
#   cd ${srcdir}/${_pyname}-${_commit}
    python -m build --wheel --no-isolation

    msg "Building Docs"
    mkdir -p dist/lib
    bsdtar -xpf dist/sphinxcontrib_collections-${pkgver}-py3-none-any.whl -C dist/lib
    rm dist/lib/sphinxcontrib/__init__.py
    PYTHONPATH="../dist/lib" make -C docs html
}

#check() {
#    cd ${srcdir}/${_pyname}-${pkgver}
##   cd ${srcdir}/${_pyname}-${_commit}
#
##   python -m venv --system-site-packages test-env
#    python -m venv test-env
#    test-env/bin/python -m pip install installer setuptools sphinx gitpython pytest
#    test-env/bin/python -m installer dist/*.whl
##   source ../test-env/bin/activate
##   source test-env/bin/activate
##   ../test-env/bin/sphinx-build -b html _build/html
#    test-env/bin/python -m pytest -vv -l -ra --color=yes -o console_output_style=count #|| warning "Tests failed" # -vv -l -ra --color=yes -o console_output_style=count -p xdist -n 4 #
##   PYTHONPATH="dist/lib" pytest -vv -l -ra --color=yes -o console_output_style=count -p xdist -n 4 #|| warning "Tests failed" # -vv -l -ra --color=yes -o console_output_style=count -p xdist -n 4 #
#}

package_python-sphinx-collections() {
    depends=('python-sphinx>3.4' 'python-jinja' 'python-gitpython' 'python-setuptools')
    cd ${srcdir}/${_pyname}-${pkgver}
#   cd ${srcdir}/${_pyname}-${_commit}

    install -D -m644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
    install -D -m644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
    python -m installer --destdir="${pkgdir}" dist/*.whl
}

package_python-sphinx-collections-doc() {
    pkgdesc="Documentation for sphinx-collections"
    cd ${srcdir}/${_pyname}-${pkgver}/docs/_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}"
}