{% set version = "3.20.3" %}

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

source:
  url: https://github.com/protocolbuffers/protobuf/archive/v{{ version }}/protobuf-v{{ version }}.tar.gz
  sha256: 9c0fd39c7a08dff543c643f0f4baf081988129a411b977a07c46221793605638
  patches:  # [py==311 or py==312]
    # see https://github.com/protocolbuffers/protobuf/pull/10403
    - patches/0001-fix-build-with-python-311.patch  # [py==311 or py==312]

build:
  number: 0
  missing_dso_whitelist:  # [s390x]
    - $RPATH/ld64.so.1    # [s390x]

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - patch     # [(not win) and (py==311 or py==312)]
    - m2-patch  # [win and (py==311 or py==312)]
  host:
    - python
    - pip
    - libprotobuf {{ version }}
  run:
    - python
    - libprotobuf {{ version }}

test:
  requires:
    - pip
  commands:
    - pip check
    - python -c "from google.protobuf.internal import api_implementation; assert api_implementation.Type() == 'cpp'"  # [unix and python_impl != "pypy"]
    - python -c "from google.protobuf.internal import api_implementation; assert api_implementation.Type() == 'python'"  # [win or (unix and python_impl == "pypy")]
  imports:
    - google
    - google.protobuf
    - google.protobuf.internal
    - google.protobuf.pyext
    - google.protobuf.util
    - google.protobuf.compiler

about:
  home: https://developers.google.com/protocol-buffers/
  license: BSD-3-Clause
  license_family: BSD
  license_file: LICENSE
  summary: Protocol Buffers - Google's data interchange format.
  description: |
    Protocol buffers are Google's language-neutral, platform-neutral, extensible
    mechanism for serializing structured data,think XML, but smaller, faster, and simpler.
  dev_url: https://github.com/protocolbuffers/protobuf
  doc_url: https://developers.google.com/protocol-buffers/docs/tutorials

extra:
  recipe-maintainers:
    - dopplershift
    - jakirkham
    - ocefpaf
    - hajapy
    - xhochy
