summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 775a66177e58edcfc517d897d4120ee5ff6a1ca5 (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-imexam
_pyname=${pkgbase#python-}
pkgname=("python-${_pyname}" "python-${_pyname}-doc")
pkgver=0.9.1
pkgrel=1
pkgdesc="A package for functionality like IRAF's imexamine"
arch=('i686' 'x86_64')
url="https://imexam.readthedocs.io"
license=('BSD' 'MIT')
makedepends=('cython'
             'python-setuptools-scm'
#            'python-wheel'
#            'python-build'
#            'python-installer'
             'xpa'
             'python-sphinx-astropy'
             'python-matplotlib'
             'python-ginga'
             'python-photutils'
             'python-scipy')
checkdepends=('python-pytest')  # 'python-photutils' 'python-matplotlib' 'python-scipy'
source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz"
        'use_system_xpa.patch'
        'add-tests-subdir-to-copy.patch')
md5sums=('07aae0abbbe4983665fd31fa2aa3b07f'
         '66b06d6b0ef7fee444e1ffb5adb15b15'
         '05b3136e0437fae80962efafe6de3636')

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

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

    patch -Np1 -i "${srcdir}/use_system_xpa.patch"
    patch -Np1 -i "${srcdir}/add-tests-subdir-to-copy.patch"
    sed -i "/doctest/s/sphinx_astropy.ext.doctest/pytest_doctestplus.sphinx.doctestplus/" docs/conf.py
}

build() {
    cd ${srcdir}/${_pyname}-${pkgver}
    python setup.py build
#   python -m build --wheel --no-isolation
    cp ${_pyname}/*.so build/lib*/${_pyname}

    msg "Building Docs"
    cd ${srcdir}/${_pyname}-${pkgver}/docs
    PYTHONPATH="../build/lib.linux-${CARCH}-cpython-$(get_pyver)" make html
}

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

    pytest || warning "Tests failed"
}

package_python-imexam() {
    depends=('python>=3.6' 'python-astropy>=3.0' 'python-matplotlib' 'python-scipy>=0.18' 'xpa')
    optdepends=('python-ginga: For Ginga viewer support'
                'ds9: For DS9 viewer support'
                'python-photutils: For photometry features'
                'python-imexam-doc: Documentation for imexam')
#               'python-pytest-astropy: For testing'
    cd ${srcdir}/${_pyname}-${pkgver}

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

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

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