{% set name = "cryptography" %}
{% set version = "49.0.0" %}

package:
  name: {{ name }}-split
  version: {{ version }}

source:
  url: https://github.com/pyca/{{ name }}/archive/refs/tags/{{ version }}.tar.gz
  sha256: a533606510cdea9e0f0616c61b18dbe3cfa5a2bbfbf48344a159d6ddc207ae13

requirements:
  host:
    - pip
    - python
  run:
    - python

build:
  number: 0
  skip: true  # [py<39]

outputs:
  - name: {{ name }}-vectors
    script: build_vectors.bat  # [win]
    script: build_vectors.sh   # [not win]
    run_exports:
      - {{ pin_subpackage('cryptography-vectors', max_pin='x.x.x') }}
    requirements:
      host:
        - pip
        - python
        - uv-build >=0.7.19,<0.12.0
      run:
        - python
    test:
      imports:
        - cryptography_vectors
      requires:
        - pip
      commands:
        - pip check
  - name: {{ name }}
    script: build_main.bat  # [win]
    script: build_main.sh   # [not win]
    requirements:
      build:
        # Do not use stdlib('c') on Windows, as it clashes with the current rust 1.90.0.
        - {{ stdlib('c') }}  # [not win]
        - {{ compiler('c') }}
        - {{ compiler('rust') }}
      host:
        - python
        - pip
        - cffi >=2.0.0
        - maturin >=1.9.4,<2,!=1.12.0
        - openssl {{ openssl }}
        - wheel
        - setuptools !=74.0.0,!=74.1.0,!=74.1.1,!=74.1.2
      run:
        - python
        - cffi>=2.0.0
        # cryptography/hazmat/bindings/_rust.abi3.so requires DSO lib/libssl.so.3
        - openssl
        - typing-extensions >=4.13.2  # [py<311]
      run_constrained:
        - bcrypt >=3.1.5
        - python !=3.9.0,!=3.9.1
    # Import tests take place in run_test.py
    test:
      imports:
        - cryptography
        - cryptography.fernet
        - cryptography.hazmat
        - cryptography.hazmat.backends
        - cryptography.hazmat.backends.openssl
        - cryptography.hazmat.bindings
        - cryptography.hazmat.bindings.openssl
        - cryptography.hazmat.primitives
        - cryptography.hazmat.primitives.asymmetric
        - cryptography.hazmat.primitives.ciphers
        - cryptography.hazmat.primitives.kdf
        - cryptography.hazmat.primitives.twofactor
        - cryptography.x509
      requires:
        - certifi >=2024
        - cryptography-vectors {{ version }}
        - pip
        - pretend >=0.7
        - pytest >=7.4.0
        - pytest-benchmark >=4.0
        - pytest-xdist >=3.5.0
      source_files:
        - tests
        - pyproject.toml
      commands:
        - echo ON  # [win]
        - pip check
        # run_test.py will check that the correct openssl version is linked
        - pytest -v tests

about:
  home: https://github.com/pyca/cryptography
  license: Apache-2.0 OR BSD-3-Clause
  license_family: OTHER
  license_file:
    - LICENSE
    - LICENSE.APACHE
    - LICENSE.BSD
    - vectors/LICENSE
    - vectors/LICENSE.APACHE
    - vectors/LICENSE.BSD
  summary: Provides cryptographic recipes and primitives to Python developers
  description: |
    Cryptography is a package which provides cryptographic recipes and
    primitives to Python developers. Our goal is for it to be your
    "cryptographic standard library". It supports 3.8+ / PyPy 7.3.11+.
    cryptography includes both high level recipes and low level interfaces to
    common cryptographic algorithms such as symmetric ciphers, 
    message digests, and key derivation functions.
  dev_url: https://github.com/pyca/cryptography
  doc_url: https://cryptography.io

extra:
  recipe-maintainers:
    - jakirkham
    - ocefpaf
    - chenghlee
