{% set on_win = SUBDIR in ('win-64', 'win-32') %}
{% set version = '4.5.12' %}

package:
  name: conda
  version: {{ version }}

source:
  fn: conda-{{ version }}.tar.gz
  url: https://github.com/conda/conda/archive/{{ version }}.tar.gz
  sha256: fcc3be72e695679f297dba57cd9d2a5e8ed9368f004219353d827e3fe82d2f51

build:
  number: 0
  # These are present when the new environment is created
  # so we have to exempt them from the list of initial files
  # for conda-build to realize they should be included.
  always_include_files:
    - bin/conda                            # [unix]
    - bin/activate                         # [unix]
    - bin/deactivate                       # [unix]
    - Scripts/activate.bat                 # [win]
    - Scripts/activate                     # [win]
    - Scripts/deactivate.bat               # [win]
    - Scripts/deactivate                   # [win]
  entry_points:
    - conda = conda.cli:main
    - conda-env = conda_env.cli.main:main

requirements:
  host:
    - python
  build:
    - m2-base              # [win]
    - m2-filesystem        # [win]
    - m2-git               # [win]
  run:
    - python
    - conda-env >=2.6
    - enum34               # [py<34]
    - futures              # [py<34]
    - menuinst             # [win]
    - pycosat >=0.6.3
    - pyopenssl >=16.2.0
    - requests >=2.12.4,<3
    - ruamel_yaml >=0.11.14
  run_constrained:
    - conda-build >=2.1
    - cytoolz >=0.8.1
    - setuptools >=31.0.1

test:
  source_files:
    - conftest.py
    - tests
    - setup.cfg
  requires:
    - mock
    - pytest
    - pexpect
    - responses
  imports:
    - conda
    - conda_env
  commands:
{% if on_win %}
    - conda activate base
    - FOR /F "delims=" %%i IN ('python -c "import sys; print(sys.version_info[0])"') DO set "PYTHON_MAJOR_VERSION=%%i"
    - set TEST_PLATFORM=win
    - FOR /F "delims=" %%i IN ('python -c "import random as r; print(r.randint(0,4294967296))"') DO set "PYTHONHASHSEED=%%i"
    - set
    - conda info
    - py.test tests -m "not integration and not installed" -vv
    - conda create -y -p .\built-conda-test-env
    - conda activate .\built-conda-test-env
    - echo %CONDA_PREFIX%
    - IF NOT "%CONDA_PREFIX%"=="%CD%\built-conda-test-env" EXIT /B 1
{% else %}
    - . $PREFIX/etc/profile.d/conda.sh
    - conda activate base
    - export PYTHON_MAJOR_VERSION=$(python -c "import sys; print(sys.version_info[0])")
    - export TEST_PLATFORM=$(python -c "import sys; print('win' if sys.platform.startswith('win') else 'unix')")
    - export PYTHONHASHSEED=$(python -c "import random as r; print(r.randint(0,4294967296))") && echo "PYTHONHASHSEED=$PYTHONHASHSEED"
    - env | sort
    - conda info
    - py.test tests -m "not integration and not installed" -vv || true
    - conda create -y -p ./built-conda-test-env
    - conda activate ./built-conda-test-env
    - echo $CONDA_PREFIX
    - '[ "$CONDA_PREFIX" = "$PWD/built-conda-test-env" ] || exit 1'
{% endif %}


about:
  home: https://conda.io
  license: BSD 3-Clause
  license_file: LICENSE.txt
  summary: OS-agnostic, system-level binary package and environment manager.
  description: |
    Conda is an open source package management system and environment
    management system for installing multiple versions of software packages
    and their dependencies and switching easily between them. It works on
    Linux, OS X and Windows, and was created for Python programs but can
    package and distribute any software.
  doc_url: https://conda.io/docs/
  dev_url: https://github.com/conda/conda

extra:
  recipe-maintainers:
    - jakirkham
    - jjhelmus
    - kalefranz
    - mcg1969
    - mingwandroid
    - msarahan
    - mwcraig
    - ocefpaf
    - patricksnape
    - pelson
    - scopatz
