borg.exe.spec 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- mode: python -*-
  2. # this pyinstaller spec file is used to build borg binaries on posix platforms and Windows
  3. import os, sys
  4. is_win32 = sys.platform.startswith('win32')
  5. # Note: SPEC contains the spec file argument given to pyinstaller
  6. here = os.path.dirname(os.path.abspath(SPEC))
  7. basepath = os.path.abspath(os.path.join(here, '..'))
  8. if is_win32:
  9. hiddenimports = ['borghash']
  10. else:
  11. hiddenimports = ['borg.platform.posix', 'borghash']
  12. block_cipher = None
  13. a = Analysis([os.path.join(basepath, 'src', 'borg', '__main__.py'), ],
  14. pathex=[basepath, ],
  15. binaries=[],
  16. datas=[
  17. (os.path.join(basepath, 'src', 'borg', 'paperkey.html'), 'borg'),
  18. ],
  19. hiddenimports=hiddenimports,
  20. hookspath=[],
  21. runtime_hooks=[],
  22. excludes=[
  23. '_ssl', 'ssl',
  24. 'pkg_resources', # avoid pkg_resources related warnings
  25. ],
  26. win_no_prefer_redirects=False,
  27. win_private_assemblies=False,
  28. cipher=block_cipher)
  29. if sys.platform == 'darwin':
  30. # do not bundle the osxfuse libraries, so we do not get a version
  31. # mismatch to the installed kernel driver of osxfuse.
  32. a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]]
  33. pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
  34. exe = EXE(pyz,
  35. a.scripts,
  36. a.binaries,
  37. a.zipfiles,
  38. a.datas,
  39. name='borg.exe',
  40. debug=False,
  41. strip=False,
  42. upx=True,
  43. console=True,
  44. icon='NONE')
  45. # Build a directory-based binary in addition to a packed
  46. # single file. This allows one to look at all included
  47. # files easily (e.g. without having to strace or halt the built binary
  48. # and introspect /tmp). Also avoids unpacking all libs when
  49. # running the app, which is better for app signing on various OS.
  50. slim_exe = EXE(pyz,
  51. a.scripts,
  52. exclude_binaries=True,
  53. name='borg.exe',
  54. debug=False,
  55. strip=False,
  56. upx=False,
  57. console=True)
  58. coll = COLLECT(slim_exe,
  59. a.binaries,
  60. a.zipfiles,
  61. a.datas,
  62. strip=False,
  63. upx=False,
  64. name='borg-dir')