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

pkgbase=python-stdatamodels
_pyname=${pkgbase#python-}
pkgname=("python-${_pyname}" "python-${_pyname}-doc")
pkgver=2.1.2
pkgrel=1
pkgdesc="Core support for DataModel classes used in calibration pipelines"
arch=('any')
url="https://stdatamodels.readthedocs.io"
license=('BSD-3-Clause')
makedepends=('python-setuptools-scm'
             'python-wheel'
             'python-build'
             'python-installer'
             'python-sphinx-asdf'
             'python-astropy'
             'python-asdf'
             'graphviz')
checkdepends=('python-pytest-doctestplus'
#             'python-pytest-xdist'
              'python-asdf-astropy'
#             'python-jwst'
              'python-psutil'
              'python-crds')   # asdf, astropy, already in makedepends
source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
md5sums=('196c351d0254c1304a6eff8d832e73df')

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

    msg "Building Docs"
    PYTHONPATH="../build/lib" make -C docs html
}

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

    # Lots of tests need jwst
#   CRDS_PATH=".crds" \
    PYTHONPATH="build/lib" pytest \
        --ignore=src/stdatamodels/jwst/datamodels \
        --ignore=src/stdatamodels/jwst/_tests/test_schemas.py \
        --ignore=src/stdatamodels/jwst/transforms/converters/tests/test_models.py \
        --ignore=src/stdatamodels/jwst/transforms/extensions.py || warning "Tests failed" # -vv -l -ra --color=yes -o console_output_style=count -p xdist -n 4
}

package_python-stdatamodels() {
    depends=('python>=3.10'
             'python-asdf>=3.1.0'
             'python-asdf_transform_schemas>=0.5.0'
             'python-asdf-astropy>=0.3.0'
             'python-astropy>=5.0.4')
    optdepends=('python-stdatamodels-doc: Documentation for STDataModel')
    cd ${srcdir}/${_pyname}-${pkgver}

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

package_python-stdatamodels-doc() {
    pkgdesc="Documentation for Python STDataModel"
    cd ${srcdir}/${_pyname}-${pkgver}/docs/build

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