summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0350d96533155c682fc4e06ac9ca44d1f8603d59 (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
# Maintainer: Astro Benzene <universebenzene at sina dot com>
pkgbase=python-spherical_geometry
_pyname=${pkgbase#python-}
pkgname=("python-${_pyname}" "python-${_pyname}-doc")
pkgver=1.2.23
pkgrel=1
pkgdesc="Python based tools for spherical geometry"
arch=('i686' 'x86_64')
url="http://www.stsci.edu/resources/software_hardware/stsci_python"
license=('BSD-3-Clause')
makedepends=('python-setuptools-scm'
             'python-wheel'
             'python-build'
             'python-installer'
             'qd>=2.3.24'
             'python-numpy'
             'python-sphinx-automodapi'
             'python-numpydoc'
             'gcc13')
checkdepends=('python-pytest'
              'python-astropy')
source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz"
        'fix_typo.patch'
        'fix_doc_warning.patch'
        'revert-inside-png-path.patch')
md5sums=('ad72571c6f83a80b49e033685a24d8c0'
         '376f76ebdf3c52048a113c386c091210'
         'fed5395d45a2275ccd5e0d63956ecddf'
         'ad61482f989d4df861753edc5af0f920')

get_pyver() {
    python -c "import sys; print('$1'.join(map(str, sys.version_info[:2])))"
}

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

#   patch -Np1 -i "${srcdir}/fix_doc_warning.patch"
    patch -Np1 -i "${srcdir}/fix_typo.patch"
    patch -Np1 -i "${srcdir}/revert-inside-png-path.patch"
    sed -i "/oldest-supported-numpy/s/, \"oldest-supported-numpy\"//" pyproject.toml
    export USE_SYSTEM_QD=1
}

build() {
    cd ${srcdir}/${_pyname}-${pkgver}
    CC=gcc-13 CXX=g++-13 python -m build --wheel --no-isolation

    msg "Building Docs"
    NUMPY_EXPERIMENTAL_DTYPE_API=1 PYTHONPATH="../build/lib.linux-${CARCH}-cpython-$(get_pyver)" \
        make -C docs html
}

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

    cp "build/lib.linux-${CARCH}-cpython-$(get_pyver)/${_pyname}/math_util.cpython-$(get_pyver)-${CARCH}-linux-gnu.so" "${_pyname}"
    NUMPY_EXPERIMENTAL_DTYPE_API=1 pytest \
        --deselect=spherical_geometry/tests/test_union.py::test_difficult_unions || warning "Tests failed" # -vv -l -ra --color=yes -o console_output_style=count
}

package_python-spherical_geometry() {
    depends=('python>=3.8' 'python-numpy>=1.18' 'qd>=2.3.24' 'python-astropy>=5.0.4')
    optdepends=('python-spherical_geometry-doc: Documentation for Spherical Geometry Toolkit')
    cd ${srcdir}/${_pyname}-${pkgver}

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

package_python-spherical_geometry-doc() {
    pkgdesc="Documentation for Python Spherical Geometry Toolkit"
    arch=('any')
    cd ${srcdir}/${_pyname}-${pkgver}/docs/_build

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