{% set name = "anaconda-anon-usage" %}
{% set version = "0.8.1" %}
{% set number = 0 %}
# We don't support 3.8 anymore, but this package is unique in that we seek
# to support as wide a range of *existing* conda installations as practical
{% set python_min = "3.8" %}

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

source:
  url: https://github.com/anaconda/{{ name }}/archive/refs/tags/{{ version }}.tar.gz
  sha256: 822eb9591fbe588e0a42dc55fc685ebc202b6b24ef74597519b8a9518935ac67

build:
  # Use a build number difference to ensure that the plugin
  # variant is slightly preferred by conda's solver.
  noarch: python
  entry_points:
   - anaconda-anon-usage = anaconda_anon_usage.main:main
  number: {{ number + 100 }}  # [variant=="plugin"]
  number: {{ number }}        # [variant=="patch"]
  script_env:
   - NEED_SCRIPTS=no   # [variant=="plugin"]
   - NEED_SCRIPTS=yes  # [variant=="patch"]

requirements:
  host:
    - python {{ python_min }}
    - setuptools
    - wheel
    - pip
  run:
    - python >={{ python_min }}        # [variant=="plugin"]
    - python >={{ python_min }},<3.11  # [variant=="patch"]
  run_constrained:
    - conda >=23.7         # [variant=="plugin"]
    - conda >=4.11,<23.7   # [variant=="patch"]

test:
  requires:
    - python {{ python_min }}
    - conda >=23.7         # [variant=="plugin"]
    - conda >=4.11,<23.7   # [variant=="patch"]
    - pip
  imports:
    - anaconda_anon_usage
    - anaconda_anon_usage.main
    - anaconda_anon_usage.patch
    - anaconda_anon_usage.tokens
  commands:
    - pip check
    - anaconda-anon-usage --version
    - anaconda-anon-usage --help
    - conda info --json
    - python -m anaconda_anon_usage.install --expect  # [variant=="patch"]

about:
  home: https://github.com/anaconda/anaconda-anon-usage
  summary: basic anonymous telemetry for conda clients
  license: BSD-3-Clause
  license_family: BSD
  license_file: LICENSE
  dev_url: https://github.com/anaconda/anaconda-anon-usage/
  doc_url: https://github.com/anaconda/anaconda-anon-usage/
  description: |
        This package augments the request header data that conda delivers
        to package servers during index and package requests. Specifically,
        three randomly generated tokens are appended to the "user agent"
        that Conda already sends with each request.

extra:
  skip-lints:
    - avoid_noarch
