borg.exe.spec 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # -*- mode: python -*-
  2. # this pyinstaller spec file is used to build borg binaries on posix platforms
  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 = []
  10. else:
  11. hiddenimports = ['borg.platform.posix', 'pkg_resources.py2_warn', ]
  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. # Build a directory-based binary in addition to a packed
  44. # single file. This allows one to look at all included
  45. # files easily (e.g. without having to strace or halt the built binary
  46. # and introspect /tmp). Also avoids unpacking all libs when
  47. # running the app, which is better for app signing on various OS.
  48. slim_exe = EXE(pyz,
  49. a.scripts,
  50. exclude_binaries=True,
  51. name='borg.exe',
  52. debug=False,
  53. strip=False,
  54. upx=False,
  55. console=True)
  56. coll = COLLECT(slim_exe,
  57. a.binaries,
  58. a.zipfiles,
  59. a.datas,
  60. strip=False,
  61. upx=False,
  62. name='borg-dir')