setup_checksums.py 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. # Support code for building a C extension with checksums code
  2. import os
  3. def xxhash_ext_kwargs(pc, system_prefix):
  4. if system_prefix:
  5. print('Detected and preferring libxxhash [via BORG_LIBXXHASH_PREFIX]')
  6. return dict(include_dirs=[os.path.join(system_prefix, 'include')],
  7. library_dirs=[os.path.join(system_prefix, 'lib')],
  8. libraries=['xxhash'])
  9. if pc and pc.installed('libxxhash', '>= 0.7.3'):
  10. print('Detected and preferring libxxhash [via pkg-config]')
  11. return pc.parse('libxxhash')
  12. raise Exception('Could not find xxhash lib/headers, please set BORG_LIBXXHASH_PREFIX')
  13. def deflate_ext_kwargs(pc, system_prefix):
  14. if system_prefix:
  15. print('Detected and preferring libdeflate [via BORG_LIBDEFLATE_PREFIX]')
  16. return dict(include_dirs=[os.path.join(system_prefix, 'include')],
  17. library_dirs=[os.path.join(system_prefix, 'lib')],
  18. libraries=['deflate'])
  19. if pc and pc.installed('libdeflate', '>= 1.5'):
  20. print('Detected and preferring libdeflate [via pkg-config]')
  21. return pc.parse('libdeflate')
  22. raise Exception('Could not find deflate lib/headers, please set BORG_LIBDEFLATE_PREFIX')