build_padding.py 705 B

123456789101112131415161718192021222324252627
  1. # This file is dual licensed under the terms of the Apache License, Version
  2. # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3. # for complete details.
  4. from __future__ import absolute_import, division, print_function
  5. import os
  6. from _cffi_src.utils import build_ffi, compiler_type, extra_link_args
  7. with open(
  8. os.path.join(os.path.dirname(__file__), "hazmat_src/padding.h")
  9. ) as f:
  10. types = f.read()
  11. with open(
  12. os.path.join(os.path.dirname(__file__), "hazmat_src/padding.c")
  13. ) as f:
  14. functions = f.read()
  15. ffi = build_ffi(
  16. module_name="_padding",
  17. cdef_source=types,
  18. verify_source=functions,
  19. extra_link_args=extra_link_args(compiler_type()),
  20. )