summaryrefslogtreecommitdiff
path: root/python/py-numpy/MAKEPKG
blob: bf5396564657d18aea660a4627e8d72f36fd622e (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
#!/bin/mkpkg
# description: Fundamental package for array computing in Python
# url: https://numpy.org/

name=py-numpy
_name=numpy
version=2.5.3
release=2
depends=(python3 openblas)
makedeps=(py-build py-installer py-meson_python py-cython meson samurai pkgconf patchelf)
source=(https://files.pythonhosted.org/packages/source/n/numpy/$_name-$version.tar.gz)

sha256sums=(
    "df2d5874ff183595a4ba404edd04f6bd9b5505c1d7708573f6a6c17489a67563"
)

build() {
    cd $_name-$version
    
    # Build wheel with explicit BLAS/LAPACK pinning to openblas.
    # --no-isolation: use system-installed py-meson_python, py-cython, etc.
    /usr/bin/python3 -m build \
        --wheel \
        --no-isolation \
        -Csetup-args=-Dblas=openblas \
        -Csetup-args=-Dlapack=openblas
    
    _pyver=$(/usr/bin/python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
    _sitedir="$PKG/usr/lib/python${_pyver}/site-packages"
    
    install -dm755 "$_sitedir"
    # py-installer: creates /usr/bin/numpy-config from the wheel's entry
    # points. No bytecode shipped: __pycache__ is created at runtime.
    /usr/bin/python3 -m installer --no-compile-bytecode --destdir "$PKG" --prefix /usr dist/*.whl
    
    # Strip dev/test bloat
    find "$_sitedir" -type d -name tests -prune -exec rm -rf {} +
    find "$_sitedir" -name "*.pyx" -delete
    
    # Strip pytest config (not imported at runtime, only when running tests)
    rm -f "$_sitedir/numpy/conftest.py"
    
    # Strip example code (rng usage examples - not runtime)
    rm -rf "$_sitedir/numpy/random/_examples"
    
    # Strip pyinstaller hooks (not used on krypt/sh)
    rm -rf "$_sitedir/numpy/_pyinstaller"
    
    # Strip f2py: Fortran wrapper generator, useless without a Fortran
    # compiler (rawnix is clang-only). numpy imports it lazily, so
    # `import numpy` is unaffected. numpy-config is kept (meson ports use it).
    rm -f "$PKG/usr/bin/f2py"
    rm -rf "$_sitedir/numpy/f2py"
}

signify() {
    untrusted comment: public key
    RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}

# vim: filetype=sh