{% set version = "41.0.7" %}

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

source:
  url: https://pypi.io/packages/source/c/cryptography/cryptography-{{ version }}.tar.gz
  sha256: 13f93ce9bea8016c253b34afc6bd6a75993e5c40672ed5405a9c832f0d4a00bc

build:
  number: 0
  skip: true  # [py<37 or win32]
  script:
  # As of cryptography version 40.0.0, build instructions have changed: https://cryptography.io/en/latest/changelog/#v40-0-0
  # here is the documentation on setting things manually, https://docs.rs/openssl/latest/openssl/#manual
  - export OPENSSL_DIR=$PREFIX        # [unix]
  - set OPENSSL_DIR=%LIBRARY_PREFIX%  # [win]
  - {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
  missing_dso_whitelist:  # [s390x]
    - $RPATH/ld64.so.1    # [s390x]
requirements:
  build:
    - {{ compiler('rust') }}
    - vs2017_{{ target_platform }}    # [win]

  host:
    - python
    - pip
    - setuptools >=61.0.0
    - setuptools-rust >=0.11.4
    - wheel
    - openssl {{openssl}}
    - cffi 1.15.1
  run:
    - python
    - cffi >=1.12
    - openssl
    - libgcc-ng     # [linux]; needed by `_rust.abi3.so`

test:
  requires:
    - cryptography-vectors {{ version }}
    - pip
    - pytest >=6.2.0
    - pytest-benchmark
    - pytest-cov
    - pytest-xdist
    - pretend
  source_files:
    - tests
    - pyproject.toml
  commands:
    - pip check
    # run_test.py will check that the correct openssl version is linked
    - pytest -n auto #  [not arm64]
    - pytest -n auto -k "not (test_der_x509_certificate_extensions[x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt] or test_x509_csr_extensions or test_no_leak_free or test_no_leak_no_malloc or test_leak or test_load_pkcs12_key_and_certificates[pkcs12/cert-key-aes256cbc.p12] or test_create_certificate_with_extensions or test_ec_derive_private_key or test_ec_private_numbers_private_key or test_create_ocsp_request or test_write_pkcs12_key_and_certificates or test_errors or test_load_pkcs12_key_and_certificates[pkcs12/cert-aes256cbc-no-key.p12] or test_ec_private_numbers_private_key or test_pem_x509_certificate_extensions[x509/cryptography.io.pem] or test_create_crl_with_idp or test_no_leak_gc or test_x25519_pubkey_from_private_key)" # [arm64]

about:
  home: https://github.com/pyca/cryptography
  license: (BSD-3-Clause OR Apache-2.0) AND PSF-2.0 AND MIT
  license_family: BSD
  license_url: https://github.com/pyca/cryptography/blob/{{ version }}/vectors/LICENSE
  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 Python 3.6+ and PyPy3 7.2+.
    cryptography includes both high level recipes and low level interfaces to
    common cryptographic algorithms such as symmetric ciphers, message digests,
    and key derivation functions.
  doc_url: https://cryptography.io/en/{{ version }}/
  dev_url: https://github.com/pyca/cryptography

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