# 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.5.1" %}

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

source:
  url: https://github.com/matplotlib/matplotlib/archive/v{{ version }}.tar.gz
  sha256: 9683da9a0c84d1c42d1bf92ecf6e012d302406a38fd987e3dfbcb7b58b2eea2d

build:
  number: 1
  # matplotlib uses its own _tkmini.h file from the Tcl / Tk 8.6 header.
  # this is an optional backend that we include.
  ignore_run_exports:   # [linux]
    - tk                # [linux]

outputs:
  - name: matplotlib-base
    script: build_base.bat  # [win]
    script: build_base.sh  # [not win]
    build:
      skip: true  # [py<37]
      ignore_run_exports:
        - tk  # [linux]
    requirements:
      build:
        - pkg-config  # [not win]
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
      host:
        - python
        - pip
        - certifi >=2020.06.20
        - freetype >=2.3
        - numpy   1.19  # [not (osx and arm64) and (py==37 or py==38 or py==39)]
        - numpy   1.21  # [(osx and arm64) and (py==38 or py==39)]
        - numpy   1.21  # [py==310]
        - setuptools
        - setuptools_scm >=4
        - setuptools_scm_git_archive
        - tk  # [linux]
      run:
        - python
        - cycler >=0.10
        - fonttools >=4.22.0
        - freetype >=2.3
        - kiwisolver >=1.0.1
        - {{ pin_compatible('numpy') }}
        - packaging >=20.0
        - pillow >=6.2.0
        - pyparsing >=2.2.1
        - python-dateutil >=2.7
        - tk  # [linux]

    test:
      imports:
        - matplotlib
        - matplotlib.pyplot
        - matplotlib._contour
        - matplotlib._image
        - matplotlib._path
        - matplotlib._tri
        - matplotlib._ttconv
        - matplotlib.backends._backend_agg
        - matplotlib.ft2font
        - matplotlib.backends._tkagg  # [not win]
        - mpl_toolkits
        - pylab
      requires:
        - pytest
        - pip
      commands:
        - pip check

  - name: matplotlib
    build:
      skip: true  # [py<37]
    requirements:
      host:
        - python
      run:
        - python
        - pyqt  # [(linux64 or win) and python_impl == "cpython"]
        - tornado
        - {{ 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:
      # running into some odd install issues with noarch on win32 only.
      skip: true  # [win32 or python_impl == "pypy"]
      skip: true  # [py<37]
      noarch: python
    requirements:
      host:
        - python
      run:
        - python >=3.7
        # 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: https://matplotlib.org/
  license: LicenseRef-PSF-based
  license_url: https://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 s(ala MATLAB or Mathematica), web
    application servers, and six graphical user interface toolkits.
  dev_url: https://github.com/matplotlib/matplotlib/
  doc_url: https://matplotlib.org/contents.html

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