2
0

setup_compress.py 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. # Support code for building a C extension with compression code
  2. import os
  3. def zstd_ext_kwargs(pc, system_prefix):
  4. if system_prefix:
  5. print('Detected and preferring libzstd [via BORG_LIBZSTD_PREFIX]')
  6. return dict(include_dirs=[os.path.join(system_prefix, 'include')],
  7. library_dirs=[os.path.join(system_prefix, 'lib')],
  8. libraries=['zstd'])
  9. if pc and pc.installed('libzstd', '>= 1.3.0'):
  10. print('Detected and preferring libzstd [via pkg-config]')
  11. return pc.parse('libzstd')
  12. raise Exception('Could not find zstd lib/headers, please set BORG_LIBZSTD_PREFIX')
  13. def lz4_ext_kwargs(pc, system_prefix):
  14. if system_prefix:
  15. print('Detected and preferring liblz4 [via BORG_LIBLZ4_PREFIX]')
  16. return dict(include_dirs=[os.path.join(system_prefix, 'include')],
  17. library_dirs=[os.path.join(system_prefix, 'lib')],
  18. libraries=['lz4'])
  19. if pc and pc.installed('liblz4', '>= 1.7.0'):
  20. print('Detected and preferring liblz4 [via pkg-config]')
  21. return pc.parse('liblz4')
  22. raise Exception('Could not find lz4 lib/headers, please set BORG_LIBLZ4_PREFIX')