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

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

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

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

build:
  number: 1
  skip: true  # [py<38]

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
        # Exact pinning from vectors' pyproject.toml
        - uv-build >=0.7.19,<0.9.0  # [py<314]
        # Loose upper pinning to allow py314 build
        - uv-build >=0.7.19,<0.10.0  # [py>=314]
      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>=1.14  # [py==38]
        - cffi>=2.0.0  # [py>=39]
        - maturin >=1.9.4,<2
        - openssl {{ openssl }}
        - setuptools !=74.0.0,!=74.1.0,!=74.1.1,!=74.1.2
      run:
        - python
        - cffi>=1.14  # [py==38]
        - cffi>=2.0.0  # [py>=39]
        # 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
