summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8865b56677125f61e8af989d88f95ff231ea01ad (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Maintainer: Astro Benzene <universebenzene at sina dot com>
pkgbase=python-drizzlepac
_pyname=${pkgbase#python-}
pkgname=("python-${_pyname}")
#"python-${_pyname}-doc")
pkgver=3.5.1
pkgrel=1
pkgdesc="AstroDrizzle for HST images"
arch=('i686' 'x86_64')
url="http://www.stsci.edu/scientific-community/software/drizzlepac.html"
license=('BSD')
makedepends=('python-setuptools-scm>=3.4'
             'python-wheel'
             'python-build'
             'python-installer'
             'python-astropy>=5.0.4'
             'python-markupsafe')
#            'python-relic'
#            'python-numpydoc'
#            'python-sphinx_rtd_theme'
#            'python-stsci_rtd_theme'
#            'python-stsci.tools'
#            'python-stsci.convolve'
#            'python-stsci.image'
#            'python-stsci.imagestats'
#            'python-stsci.imagemanip'
#            'python-stsci.ndimage'
#            'python-stsci.skypac'
#            'python-stsci.stimage'
#            'python-stwcs'
#            'python-stregion'
#            'python-fitsblender'
#            'python-nictools')
checkdepends=('python-pytest'
              'python-matplotlib'
              'python-scikit-learn'
              'python-scikit-image'
              'python-spherical_geometry'
              'python-stwcs'
              'python-stsci.skypac'
              'python-ci_watson'
              'python-fitsblender'
              'python-stsci.image'
              'python-stregion'
              'python-tweakwcs'
              'python-astroquery'
              'python-photutils'
              'python-bokeh'
              'python-pypdf2')
#              'python-pytest-remotedata'
##             'python-nictools'
#              'python-pandas'
#              'python-crds'
source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz"
       "https://raw.githubusercontent.com/spacetelescope/drizzlepac/master/tests/hap/ACSWFC3ListDefault50.csv")
md5sums=('76fa6ef47c3cacf91b98c451c415687f'
         'acaf7d8bcf0f6244042bba0df3d03679')

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 -e "/markupsafe/s/<=2.0.1//" -e '/"astropy/s/>=5.0.4//' pyproject.toml
}

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

#   msg "Building Docs"
#   python setup.py build_sphinx
}

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

#   ln -rs ${srcdir}/ACSWFC3ListDefault50.csv "build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap"
    # skip some tests that need lots of online data or cost lots of time; some files are missing in pypi package
    pytest "build/lib.linux-${CARCH}-cpython-$(get_pyinfo)" \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_run_svmpoller.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_canary.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_hrcsbc.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_ibqk07.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_ibyt50.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_j97e06.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_je281u.py \
        --ignore=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_svm_wfc3ir.py \
        --deselect=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_pipeline.py::TestSingleton::test_astrometric_singleton[iaaua1n4q] \
        --deselect=build/lib.linux-${CARCH}-cpython-$(get_pyinfo)/tests/hap/test_pipeline.py::TestSingleton::test_astrometric_singleton[iacs01t4q] || warning "Tests failed" # -vv --color=yes
}

package_python-drizzlepac() {
    depends=('python>=3.8'
             'python-scipy'
             'python-matplotlib'
             'python-requests'
             'python-scikit-learn>=0.20'
             'python-stsci.tools>=4.0'
             'python-stsci.image>=2.3.4'
             'python-stsci.imagestats'
             'python-stsci.skypac>=1.0.9'
             'python-stsci.stimage'
             'python-stwcs>=1.5.3'
             'python-tweakwcs>=0.8.0'
             'python-stregion>=1.1.7'
             'python-fitsblender>=0.4.2'
             'python-bokeh'
             'python-pandas'
             'python-spherical_geometry>=1.2.22'
             'python-astroquery>=0.4'
             'python-photutils>1.5.0'
             'python-lxml'
             'python-pypdf2'
             'python-scikit-image>=0.14.2'
             'python-pytables'
             'python-typing_extensions>4'
             'python-markupsafe')
#            'python-acstools'
#            'python-nictools')
    optdepends=('python-yaml: HAP-pipeline specific'
                'python-pysynphot'
                'python-drizzlepac-doc: Documentation for DrizzlePac')
    cd ${srcdir}/${_pyname}-${pkgver}

    install -D -m644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE.txt
    install -D -m644 -t "${pkgdir}/usr/share/doc/${pkgname}" README.md
    python -m installer --destdir="${pkgdir}" dist/*.whl
    rm -r ${pkgdir}/$(get_pyinfo site)/{doc,src,tests}
#   rm "${pkgdir}/usr/lib/python$(get_pyver)/site-packages/tests/__init__.py"
#   rm "${pkgdir}/usr/lib/python$(get_pyver)/site-packages/tests/__pycache__"/__init__*
}

#package_python-drizzlepac-doc() {
#    pkgdesc="Documentation for DrizzlePac"
#    cd ${srcdir}/${_pyname}-${pkgver}/build/sphinx
#
#    install -d -m755 "${pkgdir}/usr/share/doc/${pkgbase}"
#    cp -a html "${pkgdir}/usr/share/doc/${pkgbase}"
#}