{% set name = "pillow" %}
{% set version = "11.1.0" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
  sha256: 368da70808b36d73b4b390a8ffac11069f8a5c85f29eff1f1b01bcf3ef5b2a20
  patches:   # [osx]
    - patches/osx_sdk_path.patch  # [osx]
build:
  number: 0
  skip: true # [py<39]

requirements:
  build:
    - {{ compiler('c') }}
    - patch  # [osx]
  host:
    - python
    - pip
    - setuptools >=67.8
    - wheel
    # Required by default
    - jpeg {{ jpeg }}
    - zlib {{ zlib }}
    # Optional dependencies
    # (also can be incuded libwebp, libimagequant, libraqm,
    # libxcb, openjpeg (it causes build errors on win32),
    # see https://pillow.readthedocs.io/en/latest/installation/building-from-source.html#external-libraries)
    # A subset of one file of tk is also vendored in.
    - freetype {{ freetype }}
    - lcms2 2.16
    - libtiff {{ libtiff }}
    - libwebp-base 1.3.2
    - openjpeg {{ openjpeg }}
  run:
    - python
    - freetype >=2.10.4,<3.0a0
    - jpeg >=9e,<10a
    - libtiff >=4.2.0,<5.0a0
    - libwebp-base >=1.3.2,<2.0a0
    - openjpeg >=2.3.0,<3.0a0
    - zlib >=1.2.13,<1.3.0a0

test:
  imports:
    - PIL
    - PIL.Image
    - PIL.ImageCms  # [not win]
    # Testing _imaging to verify that it doesn't fail like reported in https://anaconda.atlassian.net/browse/PKG-5184
    - PIL._imaging
  # The upstream Tests/images contains a lot of image files that can be tested by pytest
  # but then the size of the package will increase significantly (+70Mb).
  # Pillow tests against some images that it cannot keep in-repo
  # due to anti-virus software triggering. For a slightly longer explanation, see:
  # https://github.com/conda-forge/pillow-feedstock/pull/104#issuecomment-1005245444
  requires:
    - pip
  commands:
    - pip check
    - python -c "from PIL.Image import core"

about:
  home: https://pillow.readthedocs.io
  license: HPND AND TCL
  license_family: Other
  license_file: LICENSE
  summary: Pillow is the friendly PIL fork by Alex Clark and Contributors
  description: |
    Pillow is the friendly PIL fork. PIL is the Python Imaging Library,
    adds image processing capabilities to your Python interpreter.
  doc_url: https://pillow.readthedocs.io/
  dev_url: https://github.com/python-pillow/Pillow

extra:
  recipe-maintainers:
    - jakirkham
    - patricksnape
    - pelson
    - ocefpaf
