diff --git a/projects/numpy.org/package.yml b/projects/numpy.org/package.yml new file mode 100644 index 00000000..faa23ccb --- /dev/null +++ b/projects/numpy.org/package.yml @@ -0,0 +1,51 @@ +distributable: + url: https://github.com/numpy/numpy/releases/download/v{{version}}/numpy-{{version}}.tar.gz + strip-components: 1 +versions: + github: numpy/numpy +dependencies: + openblas.net: ^0.3 + python.org: ^3.11 + gnu.org/gcc: ^13 #gfortran (no Fortran compiler found) +runtime: + env: + PYTHONPATH: $PYTHONPATH:{{prefix}}/lib/python{{deps.python.org.version.major}}/site-packages +build: + dependencies: + cython.org/libcython: '*' + llvm.org: '*' # fails with gcc + script: + - run: | + cat < site.cfg + [openblas] + libraries = openblas + library_dirs = {{deps.openblas.net.prefix}}/lib + include_dirs = {{deps.openblas.net.prefix}}/include + EOF + - python -m pip install --prefix={{prefix}} . + - run: ln -s python{{deps.python.org.version.marketing}} python{{deps.python.org.version.major}} + working-directory: ${{prefix}}/lib + - run: | + sed -i.bak "s|{{deps.python.org.prefix}}/bin/python|/usr/bin/env python|g" f2py + rm f2py.bak + working-directory: ${{prefix}}/bin + env: + # ld unrecognized option '--version' + CC: clang + CXX: clang++ + LD: clang + ATLAS: None + darwin: + BLAS: ${{deps.openblas.net.prefix}}/lib/libopenblas.dylib + LAPACK: ${{deps.openblas.net.prefix}}/lib/libopenblas.dylib + linux: + BLAS: ${{deps.openblas.net.prefix}}/lib/libopenblas.so + LAPACK: ${{deps.openblas.net.prefix}}/lib/libopenblas.so +provides: + - bin/f2py +test: + script: + - python test.py + - f2py -v | grep {{version}} + - f2py -c -m test test.f90 + - ls | grep test.cpython \ No newline at end of file diff --git a/projects/numpy.org/test.f90 b/projects/numpy.org/test.f90 new file mode 100644 index 00000000..4994106c --- /dev/null +++ b/projects/numpy.org/test.f90 @@ -0,0 +1,6 @@ +! example.f90 +subroutine add_numbers(a, b, c) + real, intent(in) :: a, b + real, intent(out) :: c + c = a + b +end subroutine add_numbers \ No newline at end of file diff --git a/projects/numpy.org/test.py b/projects/numpy.org/test.py new file mode 100644 index 00000000..3a4915a2 --- /dev/null +++ b/projects/numpy.org/test.py @@ -0,0 +1,4 @@ +import numpy as np +t = np.ones((3,3), int) +assert t.sum() == 9 +assert np.dot(t, t).sum() == 27 \ No newline at end of file