summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c35aefa185a62284a617f951d2d6ab698068f529 (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
# Maintainer: Astro Benzene <universebenzene at sina dot com>
# Contributor: Nabil Freij <nabil.freij@gmail.com>

pkgbase=python-glymur
_pyname=${pkgbase#python-}
#_pyname=Glymur
pkgname=('python-glymur' 'python-glymur-doc')
pkgver=0.13.6
#_commit="d0134123978678d33573d53a144ce1634e770e10"
pkgrel=1
pkgdesc="Tools for accessing JPEG2000 files"
arch=('any')
url="https://glymur.readthedocs.org"
license=('MIT')
makedepends=('python-setuptools'
             'python-wheel'
             'python-build'
             'python-installer'
             'python-numpydoc'
             'python-sphinx_rtd_theme'
             'python-lxml')
checkdepends=('python-pytest'
#             'python-pytest-xdist'
              'python-numpy'
              'python-lxml'
#             'openjpeg2'   # <- pillow <- skimage
              'python-scikit-image'
              'python-gdal')
#              'python-imagecodecs')
source=("https://github.com/quintusdias/glymur/archive/refs/tags/v${pkgver}.tar.gz"
        'fix-sphinx8-intersphinx.patch')
#source=("https://github.com/quintusdias/glymur/archive/refs/tags/v${pkgver/.p/p}.tar.gz")
#source=("${_pyname}-${pkgver}.tar.gz::https://github.com/quintusdias/glymur/archive/${_commit}.tar.gz")
#source=("https://files.pythonhosted.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
#       "https://github.com/quintusdias/glymur/raw/master/tests/data/0220000800_uuid.dat"
#       "https://raw.githubusercontent.com/quintusdias/glymur/master/tests/data/issue555.xmp"
#       "https://github.com/quintusdias/glymur/raw/master/tests/data/issue549.dat"
#       "https://github.com/quintusdias/glymur/raw/master/tests/data/issue572.tif"
#       "https://github.com/quintusdias/glymur/raw/master/tests/data/issue982.j2k"
#       "https://github.com/quintusdias/glymur/raw/master/tests/data/uint16.j2k"
#       "https://github.com/quintusdias/glymur/raw/master/tests/data/basn6a08.tif"
#       "https://raw.githubusercontent.com/quintusdias/glymur/master/docs/source/whatsnew/0.10.rst"
#       "https://raw.githubusercontent.com/quintusdias/glymur/master/docs/source/whatsnew/0.11.rst"
#       "https://raw.githubusercontent.com/quintusdias/glymur/master/docs/source/whatsnew/0.12.rst")
md5sums=('68ce97d344a389b7dc63a4cc87f5c128'
         'c95fe75b7d3b0e8d1de91a7d9dfc2c2a')
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP'
#        'SKIP')

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

prepare() {
    cd ${srcdir}/${_pyname}-${pkgver}
#
#    ln -rs ${srcdir}/issue* tests/data
#    ln -rs ${srcdir}/0220* tests/data
#    ln -rs ${srcdir}/uint* tests/data
#    ln -rs ${srcdir}/basn* tests/data
#    ln -rs ${srcdir}/0.10.rst docs/source/whatsnew
#    ln -rs ${srcdir}/0.11.rst docs/source/whatsnew
#    ln -rs ${srcdir}/0.12.rst docs/source/whatsnew
    patch -Np1 -i "${srcdir}/fix-sphinx8-intersphinx.patch"
}

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

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

check() {
    cd ${srcdir}/${_pyname}-${pkgver}
#   cd ${srcdir}/${_pyname}-${pkgver/.p/p}
#   cd ${srcdir}/${_pyname}-${_commit}

    pytest || warning "Tests failed" # -vv -ra --color=yes -o console_output_style=count -p xdist -n 4
#       tests/test_tiff2jp2.py::TestSuite::test_rgba_interface_big_endian
#       tests/test_tiff2jp2.py::TestSuite::test_rgba_interface_big_endian_stripped
#       tests/test_tiff2jp2.py::TestSuite::test_rgba_interface_big_endian_tiled
}

package_python-glymur() {
    cd ${srcdir}/${_pyname}-${pkgver}
#   cd ${srcdir}/${_pyname}-${pkgver/.p/p}
#   cd ${srcdir}/${_pyname}-${_commit}
    depends=('python-numpy' 'python-lxml' 'python-packaging')
    optdepends=('openjpeg2'
                'python-gdal'
                'python-scikit-image'
                'python-glymur-doc: Documentation for Python Glymur')

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

package_python-glymur-doc() {
    pkgdesc="Documentation for Python Glymur module"
    cd ${srcdir}/${_pyname}-${pkgver}/docs/build
#   cd ${srcdir}/${_pyname}-${pkgver/.p/p}/docs/build
#   cd ${srcdir}/${_pyname}-${_commit}/docs/build

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