{% set version = "1.16.0" %}

package:
  name: cffi
  version: {{ version }}

source:
  url: https://pypi.io/packages/source/c/cffi/cffi-{{ version }}.tar.gz
  sha256: bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0
  patches:
    - setup-linux.patch  # [not win]
    - 0001-Link-to-dl-library.patch
    - apple-jit.patch  # [osx]

build:
  number: 0
  script: {{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv
  missing_dso_whitelist:
    - $RPATH/ld64.so.1  # [s390x]
  skip: true # [py<38]

requirements:
  build:
    - {{ compiler('c') }}
    - patch     # [not win]
    - m2-patch  # [win]
  host:
    - python
    - pip
    - setuptools
    - wheel
  run:
    - python
    # set lower bound to avoid hotfix to lower it to <3.3
    - libffi >=3.4,<3.5 # [not win]
    - pycparser

test:
  imports:
    - cffi
    - _cffi_backend
  requires:
    - pip
  commands:
    - pip check
    - python -X faulthandler -c "from cffi import FFI; print(FFI().dlopen('ucrtbase'))"  # [win]
    - python -X faulthandler -c "from cffi import FFI; print(FFI().dlopen(None))"  # [not win]

about:
  home: https://cffi.readthedocs.io
  license: MIT
  license_family: MIT
  license_file: LICENSE
  summary: Foreign Function Interface for Python calling C code.
  description: |
    Cffi aims to allow users to call C code from Python without having to
    learn a 3rd language. It provides a convenient and reliable way to call
    compiled C code from Python using interface declarations written in C.
  doc_url: https://cffi.readthedocs.io
  dev_url: https://github.com/python-cffi/cffi

extra:
  recipe-maintainers:
    - goanpeca
    - inducer
    - ocefpaf
    - mingwandroid
