{% set version = "0.9.11" %}

package:
  name: pythran
  version: {{ version }}

source:
  url: https://pypi.io/packages/source/p/pythran/pythran-{{ version }}.tar.gz
  sha256: a317f91e2aade9f6550dc3bf40b5caeb45b7e012daf27e2b3e4ad928edb01667

build:
  number: 3
  script:
    # prevent d1trimfile option being added which clang-cl does not understand.
    # d1trimfile option is added by a patch and disabled by unsetting SRC_DIR
    # https://github.com/conda-forge/python-feedstock/blob/e7ea437a819f8f06dcbc3769f6e46dc026070c44/recipe/patches/0021-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch
    - set "SRC_DIR="   # [win]
    - {{ PYTHON }} -c "import os, shutil; shutil.rmtree(os.path.join('pythran', 'xsimd'))"
    - "{{ PYTHON }} -c \"with open('setup.cfg', 'w') as s: s.write('[build_py]\\nno_xsimd=True')\""  # [not win]
    - {{ PYTHON }} -m pip install . --no-deps -vv
  entry_points:
    - pythran = pythran.run:run
    - pythran-config = pythran.config:run

requirements:
  build:
    - {{ compiler('cxx') }}  # [not win]
    - clang                  # [win]
    - clangxx                # [win]
  host:
    - python
    - pip
    - numpy
    - pytest-runner
    - setuptools
    - wheel
  run:
    - {{ compiler('cxx') }}  # [not win]
    - clang                  # [win]
    - clangxx                # [win]
    - python
    - {{ pin_compatible('numpy') }}
    - decorator
    - gast 0.4
    - networkx >=2
    - ply >=3.4
    - six
    - beniget 0.3
    - xsimd

test:
  requires:                           # [osx]
    # default to testing openblas
    - openblas-devel {{ openblas }}   # [osx]
    - {{ compiler('c') }}  # [osx]
  files:
    - dprod.py
    - simple_numexpr.py
  commands:
    - export CBS="-isysroot $(xcrun --show-sdk-path)" # [osx]
    - export CFLAGS="${CFLAGS} ${CBS}"  # [osx]
    - export CXXFLAGS="${CXXFLAGS} ${CBS}"  # [osx]
    - export LDFLAGS="${LDFLAGS} ${CBS}"  # [osx]
    - set "SRC_DIR="  # [win]
    - pythran -v dprod.py
    - python -c "import dprod"
    - pythran -v simple_numexpr.py -DUSE_XSIMD -march=native  # [not (ppc64le or s390x or (osx and arm64))]
    - pythran -v simple_numexpr.py -DUSE_XSIMD                # [osx and arm64]
    - pythran -v simple_numexpr.py                            # [ppc64le or s390x]
    - python -c "import simple_numexpr"
  imports:
    - omp  # [not win]
    - pythran
    - pythran.analyses
    - pythran.optimizations
    - pythran.transformations
    - pythran.types

about:
  home: http://github.com/serge-sans-paille/pythran
  license: BSD-3-Clause
  license_family: BSD
  license_file: LICENSE
  summary: a claimless python to c++ converter

  description: |
    Pythran is an ahead of time compiler for a subset of the Python language,
    with a focus on scientific computing. It takes a Python module annotated
    with a few interface description and turns it into a native Python module
    with the same interface, but (hopefully) faster.
  doc_url: https://pythran.readthedocs.io/
  dev_url: https://github.com/serge-sans-paille/pythran

extra:
  recipe-maintainers:
    - saraedum
    - serge-sans-paille
