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

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

source:
  url: https://github.com/matplotlib/matplotlib/archive/v{{ version }}.tar.gz
  sha256: ce7cebd3df11a032fff9b3a32029f49f0fc7c322f556f26ea9ef812d6e43cb21
  patches:                    # [osx]
    - fix_osx_1011_dep.patch  # [osx]

build:
  number: 0
  skip: true  # [py<36]
  # 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]
    requirements:
      build:
        - python                                 # [build_platform != target_platform and not win]
        - cross-python_{{ target_platform }}     # [build_platform != target_platform and not win]
        - numpy                                  # [build_platform != target_platform and not win]
        - pkg-config  # [not win]
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
      host:
        - python
        - pip
        - numpy
        - cycler >=0.10
        - python-dateutil
        - freetype
        - nose
        - pyparsing
        - 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.0.3,!=2.0.4,!=2.1.2,!=2.1.6
        - tk  # [linux]
        - tornado
        - kiwisolver >=1.0.1
      # run_constrained:
        # - __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.11") }}  # [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:
    requirements:
      host:
        - python
      run:
        - python
        - pyqt  # [(linux64 or win) 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:
      # running into some odd install issues with noarch on win32 only.
      skip: true  # [win32 or python_impl == "pypy"]
      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
