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

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

source:
  url: https://github.com/matplotlib/matplotlib/archive/v{{ version }}.tar.gz
  sha256: 83e97200421dc8b0022eba92f03174d9bf80c966df25a6f03f44608bfe36a7ac
  patches:  # [unix]
    # s390x fails to download qhull. This patch changes the download URL to point to Github. 
    # You must manually update LOCAL_QHULL_VERSION and LOCAL_QHULL_HASH from upstream.
    - 000_use_github_url_qhull.patch  # [unix]

build:
  number: 0

outputs:
  - name: matplotlib-base
    script: build_base.bat  # [win]
    script: build_base.sh  # [not win]
    build:
      skip: true  # [py<39]
    requirements:
      build:
        - pkg-config 
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - patch  # [unix]
      host:
        - python
        - pip
        - certifi >=2020.06.20
        - freetype 2.10
        - numpy {{ numpy }}
        - setuptools 
        - setuptools_scm >=7
        - wheel
        - pybind11 >=2.6
      run:
        - python
        - __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }}  # [osx and x86_64]
        - cycler >=0.10
        - contourpy >=1.0.1
        - fonttools >=4.22.0
        - freetype >=2.10
        - kiwisolver >=1.0.1
        - {{ pin_compatible('numpy') }}
        - packaging >=20.0
        - pillow >=6.2.0
        - pyparsing >=2.3.1,<3.1
        - python-dateutil >=2.7
        - importlib_resources >=3.2.0  # [py<310]
    test:
      imports:
        - matplotlib
        - matplotlib.pyplot
        - matplotlib._image
        - matplotlib._path
        - matplotlib._qhull
        - matplotlib._tri
        - matplotlib._ttconv
        - matplotlib.backends._backend_agg
        - matplotlib.ft2font
        - matplotlib.backends._tkagg  # [not win]
        - mpl_toolkits
        - pylab
      requires:
        - pip
      commands:
        - pip check

  - name: matplotlib
    build:
      skip: true  # [py<39]
    requirements:
      host:
        - python
      run:
        - python
        - pyqt >=5  # [(linux64 or win) and python_impl == "cpython"]
        - tornado >=5
        - {{ pin_subpackage('matplotlib-base', max_pin="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<39]
      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: https://matplotlib.org/
  license: LicenseRef-PSF-based
  license_family: PSF
  license_file: LICENSE/LICENSE
  summary: Publication quality figures in Python
  description: |
    Matplotlib produces publication-quality figures in a variety of hardcopy formats
    and interactive environments across platforms. Matplotlib can be used in
    Python scripts, Python/IPython shells, web application servers,
    and various graphical user interface toolkits.
  dev_url: https://github.com/matplotlib/matplotlib/
  doc_url: https://matplotlib.org/

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