borg.exe.spec 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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', 'pkg_resources.py2_warn', '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. ],
  25. win_no_prefer_redirects=False,
  26. win_private_assemblies=False,
  27. cipher=block_cipher)
  28. if sys.platform == 'darwin':
  29. # do not bundle the osxfuse libraries, so we do not get a version
  30. # mismatch to the installed kernel driver of osxfuse.
  31. a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]]
  32. pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
  33. exe = EXE(pyz,
  34. a.scripts,
  35. a.binaries,
  36. a.zipfiles,
  37. a.datas,
  38. name='borg.exe',
  39. debug=False,
  40. strip=False,
  41. upx=True,
  42. console=True,
  43. icon='NONE')
  44. # Build a directory-based binary in addition to a packed
  45. # single file. This allows one to look at all included
  46. # files easily (e.g. without having to strace or halt the built binary
  47. # and introspect /tmp). Also avoids unpacking all libs when
  48. # running the app, which is better for app signing on various OS.
  49. slim_exe = EXE(pyz,
  50. a.scripts,
  51. exclude_binaries=True,
  52. name='borg.exe',
  53. debug=False,
  54. strip=False,
  55. upx=False,
  56. console=True)
  57. coll = COLLECT(slim_exe,
  58. a.binaries,
  59. a.zipfiles,
  60. a.datas,
  61. strip=False,
  62. upx=False,
  63. name='borg-dir')