# Full credit goes to https://github.com/conda/conda-recipes for providing this recipe.
# It has been subsequently adapted for automated building with conda-forge.

{% set version = "3.4.2" %}

package:
  name: matplotlib-suite
  version: {{ version }}

source:
  url: https://github.com/matplotlib/matplotlib/archive/v{{ version }}.tar.gz
  sha256: e5960bcb964ee77d37752f7a1db4568d85e99d8857fbf20289dda2edfa711675
  patches:
    - pypi.patch  # [python_impl == "pypy"]


build:
  number: 0

outputs:
  - name: matplotlib-base
    script: build_base.bat  # [win]
    script: build_base.sh  # [not win]
    build:
      skip: true  # [py<37]
    requirements:
      build:
        - python                                 # [build_platform != target_platform]
        - cross-python_{{ target_platform }}     # [build_platform != target_platform]
        - numpy                                  # [build_platform != target_platform]
        - pkg-config  # [not win]
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
      host:
        - python
        - pip
        - numpy
        - cycler >=0.10
        - python-dateutil >=2.7
        - freetype
        - nose
        - pyparsing >=2.2.1
        - tk  # [linux]
      run:
        - python
        - setuptools
        - {{ pin_compatible('numpy') }}
        - certifi >=2020.06.20
        - cycler >=0.10
        - python-dateutil >=2.1
        - pillow >=6.2.0
        - freetype
        - pyparsing >=2.2.1
        - tk  # [linux]
        - tornado
        - kiwisolver >=1.0.1
      run_constrained:
        - __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }}  # [osx]
    test:
      requires:
        - pytest
      imports:
        - matplotlib
        - matplotlib.pyplot
        - matplotlib._image
        - matplotlib._path
        - matplotlib._tri
        - matplotlib.backends._backend_agg
        - matplotlib.ft2font
        - matplotlib.ttconv
        - matplotlib.backends._tkagg  # [not win]
        - mpl_toolkits
        - pylab

  - name: matplotlib
    build:
      skip: true  # [py<37]
    requirements:
      host:
        - python
      run:
        - python
        - pyqt  # [not osx and not aarch64 and not ppc64le and python_impl == "cpython"]
        - {{ pin_subpackage('matplotlib-base', max_pin="x.x.x.x") }}
    test:
      imports:
        - matplotlib

  - name: mpl_sample_data
    script: install-data.sh  # [not win]
    script: install-data.bat  # [win]
    build:
      skip: true  # [python_impl == "pypy"]
      skip: true  # [py<37]
      noarch: python
    requirements:
      host:
        - python
      run:
        - python
        # match major/minor version, but allow noarch
        - {{ pin_subpackage('matplotlib-base', max_pin="x.x") }}
    test:
      imports:
        - matplotlib.cbook
      commands:
        - python -c "import matplotlib; matplotlib.cbook.get_sample_data('msft.csv', asfileobj=False)"

about:
  home: http://matplotlib.org/
  license: LicenseRef-PSF-based
  license_url: http://matplotlib.sourceforge.net/users/license.html
  license_family: PSF
  license_file: LICENSE/LICENSE
  summary: Publication quality figures in Python
  description: |
    matplotlib is a python 2D plotting library which produces publication
    quality figures in a variety of hardcopy formats and interactive
    environments across platforms. matplotlib can be used in Python scripts,
    the Python and IPython shell (ala MATLAB or Mathematica), web
    application servers, and six graphical user interface toolkits.
  dev_url: https://github.com/matplotlib/matplotlib/
  doc_url: http://matplotlib.org/contents.html

extra:
  recipe-maintainers:
    - mdboom
    - ocefpaf
    - pelson
    - tacaswell
    - dopplershift
