{% set name = "numpy" %}
{% set version = "1.15.3" %}

package:
  name: numpy_and_dev
  version: {{ version }}

source:
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.zip
  sha256: 1c0c80e74759fa4942298044274f2c11b08c86230b25b8b819e55e644f5ff2b6
  patches:
    - 0001-fix-windows-case-sensitivity.patch
    - 0002-simplify-arch-flags.patch
    - 0003-Obtain-and-prefer-custom-gfortran-from-env-variable.patch
    - 0004-disable-memmap-filename-test-due-to-CI-link-confusio.patch
    - 0005-disable-broken-tests.patch
    {% if blas_impl == "mkl" and (not win or vc|int >= 14) -%}
    # patches for MKL based enhancements
    - 0006-use-mklfft-when-available.patch
    - 0007-define-mkl_version-in-__init__.py.patch
    - 0008-intel-umath-optimizations.patch
    - 0009-intel-mkl_mem-all.patch
    - 0010-intel-init_mkl.patch
    - 0011-intel-mkl_random.patch
    # patch up MKL patches
    - 0012-Remove-ICC-specific-flags.patch
    - 0013-Remove-np.invsqrt.patch
    - 0014-Rewrite-inlining.patch
    {%- endif %}
    # precision issue with longdouble on ppc64le
    # https://github.com/numpy/numpy/pull/8566
    - 0015-skip-test_loss_of_precision_longcomplex-test.patch  # [ppc64le]

build:
  number: 0
  skip: True  # [blas_impl == 'openblas' and win]
  force_use_keys:
    - python

outputs:
  # this one has all the actual contents
  - name: numpy-base
    script: install_base.sh   # [unix]
    script: install_base.bat  # [win]
    requirements:
      build:
        - {{ compiler("c") }}
        - {{ compiler("fortran") }}
        # HACK: need this for libquadmath.  Should fix the gcc package
        - libgcc-ng                  # [linux]
      host:
        - cython
        - python
        - setuptools
        - mkl-devel  {{ mkl }}  # [blas_impl == "mkl"]
        - openblas-devel {{ openblas }}  # [blas_impl == "openblas"]
      run:
        - python
    test:
      commands:
        - test -e $SP_DIR/numpy/distutils/site.cfg     # [unix]
        - IF NOT EXIST %SP_DIR%\numpy\distutils\site.cfg exit 1  # [win]

  # devel exists mostly to add the run_exports info.
  - name: numpy-devel
    build:
      run_exports:
        - {{ pin_subpackage('numpy') }}
    requirements:
      host:
        - python
        # these import blas metapackages to ensure consistency with downstream libs that also use blas
        - mkl-devel  {{ mkl }}  # [blas_impl == 'mkl']
        - openblas-devel {{ openblas }}  # [blas_impl == 'openblas']
      run:
        - python
        - {{ pin_subpackage('numpy-base', exact=True) }}

  # metapackage for things that don't use numpy's C interface, or things
  - name: numpy
    requirements:
      build:
        # for runtime alignment
        - {{ compiler('c') }}
        - {{ compiler('fortran') }}
      host:
        - python
        # these import blas metapackages to ensure consistency with downstream libs that also use blas
        - mkl-devel  {{ mkl }}  # [blas_impl == 'mkl']
        - openblas-devel {{ openblas }}  # [blas_impl == 'openblas']
      run:
        - python
        - {{ pin_subpackage('numpy-base', exact=True) }}
        # openblas or mkl runtime included with run_exports
        - mkl_fft  >=1.0.4  # [blas_impl == 'mkl']
        - mkl_random # [blas_impl == 'mkl' and (not win or vc>=14)]

    test:
      script: numpy_test.py
      requires:
        - pytest
        - {{ compiler('c') }}
        - {{ compiler('fortran') }}
        - nomkl  # [x86 and blas_impl != 'mkl']
      commands:
        - f2py -h
        - python -c "import numpy; numpy.show_config()"
      imports:
        - numpy
        - numpy.linalg.lapack_lite

    about:
      home: http://numpy.scipy.org/
      license: BSD 3-Clause
      license_file: LICENSE.txt
      summary: 'Array processing for numbers, strings, records, and objects.'
      description: |
        NumPy is the fundamental package needed for scientific computing with Python.
      doc_url: https://docs.scipy.org/doc/numpy-{{ version }}/reference/
      dev_url: https://github.com/numpy/numpy
      dev_source_url: https://github.com/numpy/numpy/tree/master/doc

extra:
  recipe-maintainers:
    - jakirkham
    - msarahan
    - pelson
    - rgommers
    - ocefpaf
