{% set version = "1.0.5" %}
{% set build = 1 %}

package:
  name: theano
  version: {{ version }}

source:
  fn: Theano-{{ version }}.tar.gz
  url: https://pypi.io/packages/source/T/Theano/Theano-{{ version }}.tar.gz
  sha256: 6e9439dd53ba995fcae27bf20626074bfc2fff446899dc5c53cb28c1f9202e89
  patches:
    - 0001-Add-support-for-custom-compiler.patch
    - 0002-Extend-default-flags-for-win-32.patch  # [win]

build:
  number: {{ build }}
  # # Anaconda's s390x does not contain depdendencies for pygpu >=0.7,<0.8.0a0, this package is skipped for s390x at this time.
  skip: True  # [s390x]
  script:
    - '[[ -f theano/scan_module/c_code/scan_perform.c ]] && rm -f theano/scan_module/c_code/scan_perform.c'  # [unix]
    - if exist theano\scan_module\c_code\scan_perform.c del /q theano\scan_module\c_code\scan_perform.c      # [win]
    - python setup.py install --single-version-externally-managed --record record.txt
  entry_points:
    - theano-cache = bin.theano_cache:main
    - theano-nose = bin.theano_nose:main

requirements:
  build:
    - m2-patch  # [win]
    - patch     # [not win]
  host:
    - python
    - cython
    - pip
    - setuptools
    - wheel
  run:
    - {{ compiler('c') }}    # [unix]
    - {{ compiler('cxx') }}  # [unix]
    - python
    - libpython >=2.0        # [win]
    - m2w64-toolchain        # [win]
    - numpy >=1.9.1
    - scipy >=0.14
    - six >=1.9.0
    - {{ pin_compatible('pygpu', '0.7', max_pin='0.8') }} # [not osx]

test:
  requires:
    - nose >=1.3.0
    - nose-parameterized >=0.5.0
    - parameterized
    - pip
  imports:
    - bin
    - theano
    - theano.compile
    - theano.compile.sandbox
    - theano.compile.tests
    - theano.gof
    - theano.gof.tests
    - theano.gpuarray
    - theano.gpuarray.dnn
    - theano.gpuarray.linalg
    - theano.misc
    - theano.sandbox
    - theano.scalar
    - theano.scalar.tests
    - theano.sparse
    - theano.sparse.tests
    - theano.tensor
    - theano.tensor.nnet
    - theano.tensor.nnet.tests
    - theano.tensor.signal
    - theano.tensor.signal.tests
    - theano.tensor.tests
    - theano.tests
  source_files:
    - theano/tests
  commands:
    - pip check
    - MKL_THREADING_LAYER=GNU theano-cache help            # [unix and not (osx and arm64)]
    - MKL_THREADING_LAYER=GNU theano-nose -v theano/tests  # [unix and not osx]
    - set MKL_THREADING_LAYER=GNU&& theano-cache help            # [win]
    - set MKL_THREADING_LAYER=GNU&& theano-nose -v theano/tests  # [win]

about:
  home: https://github.com/Theano/Theano
  license: BSD-3-Clause
  license_family: BSD
  summary: 'Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.'
  license_file: LICENSE.txt
  description: |
    Theano is a Python library that allows you to define, optimize, and
    evaluate mathematical expressions involving multi-dimensional arrays
    efficiently, featuring tight integration with NumPy, transparent use
    of a GPU, efficient symbolic differentiation, speed and stability
    optimizations and dynamic C code generation.
  # MILA will stop developing Theano: https://groups.google.com/d/msg/theano-users/7Poq8BZutbY/rNCIfvAEAwAJ
  # The PyMC developers have forked Theano to a new project called Aesara that is being actively developed: https://github.com/aesara-devs/aesara
  dev_url: https://github.com/Theano/Theano
  doc_url: https://theano-pymc.readthedocs.io/en/latest/

extra:
  recipe-maintainers:
    - abergeron
    - jakirkham
    - ocefpaf
    - ericmjl
