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

pkgbase=python-h5pyd
_pyname=${pkgbase#python-}
pkgname=("python-${_pyname}" "python-${_pyname}-doc")
pkgver=0.18.0
_commit="094f0b2b7e2a777f6dc1a6f60851cc856067d9a2"
pkgrel=1
pkgdesc="h5py distributed - Python client library for HDF Rest API "
arch=('any')
url="https://github.com/HDFGroup/h5pyd"
license=('BSD-3-Clause')
makedepends=('python-setuptools'
#            'python-wheel'
             'python-pkgconfig'
             'python-sphinx-furo')
#            'python-build'
#            'python-installer'
checkdepends=('python-pytest'
              'python-numpy'
              'python-pytz'
              'python-requests-unixsocket')
#             'python-adal'
#source=("https://files.pythonhosted.org/packages/source/${_pyname:0:1}/${_pyname}/${_pyname}-${pkgver}.tar.gz"
source=("${_pyname}-${pkgver}.tar.gz::https://github.com/HDFGroup/h5pyd/archive/${_commit}.tar.gz"
#source=("${_pyname}-${pkgver}.tar.gz::https://github.com/HDFGroup/h5pyd/archive/refs/tags/v${pkgver}.tar.gz"
        "https://raw.githubusercontent.com/h5py/h5py/master/examples/bytesio.py"
        "https://raw.githubusercontent.com/h5py/h5py/master/examples/swmr_inotify_example.py"
        "https://raw.githubusercontent.com/h5py/h5py/master/examples/swmr_multiprocess.py"
        'fix-h5type-test.patch')
md5sums=('d0dfe45a695db36f22738200bf120bf4'
         'SKIP'
         'SKIP'
         'SKIP'
         'fce3d7b92909be61507392ab33bfce0a')

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

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

    ln -rs ${srcdir}/*.py examples
    sed -i -e "/GH/s/GH/GH\%s/" -e "/PR/s/PR/PR\%s/" docs/conf.py
    patch -Np1 -i "${srcdir}/fix-h5type-test.patch"
}

build() {
#   cd ${srcdir}/${_pyname}-${pkgver}
    cd ${srcdir}/${_pyname}-${_commit}
    python setup.py build
    python setup.py egg_info # need for release = metadata.version; ln -rs ...
#   python -m build --wheel --no-isolation

    msg "Building Docs"
#   python setup.py build_sphinx # died since py3.11
#   ln -rs ${srcdir}/${_pyname}-${pkgver}/${_pyname/-/_}*egg-info \
    ln -rs ${srcdir}/${_pyname}-${_commit}/${_pyname/-/_}*egg-info \
        build/lib/${_pyname/-/_}-${pkgver}-py$(get_pyver .).egg-info
    PYTHONPATH="../build/lib" make -C docs html
}

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

    mkdir .test
    H5PYD_TEST_FOLDER=${PWD}/.test pytest || warning "Tests failed" #${PWD}/test \ -vv -ra --color=yes -o console_output_style=count
#   PYTHONPATH="build/lib" pytest #|| warning "Tests failed" #${PWD}/test \
#       --ignore=build/lib/h5pyd/_hl/h5type_test.py #|| warning "Tests failed"
}

package_python-h5pyd() {
    depends=('python-numpy>=1.17.3'
             'python-requests-unixsocket'
             'python-pytz'
#            'python-cryptography'
             'python-pyjwt')
    optdepends=('python-msrestazure: extra azure support'
                'python-adal: extra azure support'
                'python-google-api-python-client: extra google support'
                'python-google-auth-oauthlib: extra google support'
                'python-google-auth: extra google support'
                'python-s3fs: extra aws support'
                'python-h5py: extra hdf5 support'
                'python-h5pyd-doc: Documentation for h5pyd')
#   cd ${srcdir}/${_pyname}-${pkgver}
    cd ${srcdir}/${_pyname}-${_commit}

    install -D -m644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
    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-h5pyd-doc() {
    pkgdesc="Documentation for Python h5pyd"
#   cd ${srcdir}/${_pyname}-${pkgver}/build/sphinx
#   cd ${srcdir}/${_pyname}-${pkgver}/docs/_build
    cd ${srcdir}/${_pyname}-${_commit}/docs/_build
#   cd ${srcdir}/${_pyname}-${_commit}/build/sphinx

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