summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 33652a70db6da872b55c24965603e7de997000fd (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
# 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.14.8
#_pkgver=0.14.0post2
#_commit="d0134123978678d33573d53a144ce1634e770e10"
pkgrel=1
pkgdesc="Tools for accessing JPEG2000 files"
arch=('any')
url="https://glymur.readthedocs.org"
license=('MIT')
makedepends=('python-setuptools-scm>=8.0'
             'python-build'
             'python-installer'
             'python-numpydoc'
             'python-sphinx_rtd_theme'
             'python-lxml'
             'python-pillow'
         )
checkdepends=('python-pytest'
#             'python-pytest-xdist'
#             'openjpeg2'   # <- pillow <- skimage
              'python-scikit-image'
              'python-gdal')    # np <- skimage, lxml pillow already in makedepends
#              'python-imagecodecs')
source=("https://files.pythonhosted.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
#        "${pkgver}-conftest.py::https://github.com/quintusdias/glymur/raw/refs/tags/v${pkgver}/conftest.py"
#source=("https://github.com/quintusdias/glymur/archive/refs/tags/v${pkgver}.tar.gz"
#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=('f35c95b164d6590b6be3d33a7032f336')
#        '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}
##   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
##    ln -rs {${srcdir}/${pkgver}-,}conftest.py
##   patch -Np1 -i "${srcdir}/fix-sphinx8-intersphinx.patch"
##   sed -i "s/'MIT'/{ text = 'MIT' }/" pyproject.toml
##    sed -e "/platform.system/s/linux/Linux/" -e "/os_release/s/and/or/" \
##        -e "/os_release/s/id/ID/" -i tests/fixtures.py
#}

build() {
    cd ${srcdir}/${_pyname}-${pkgver}
#   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="${srcdir}/${_pyname}-${_pkgver}/build/lib" make -C docs html
    PYTHONPATH="build/lib" make -C docs html
}

check() {
    cd ${srcdir}/${_pyname}-${pkgver}
#   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}
#   cd ${srcdir}/${_pyname}-${pkgver/.p/p}
#   cd ${srcdir}/${_pyname}-${_commit}
    depends=('python-numpy' 'python-lxml' 'python-pillow')
    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}/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}"
}