UltiMaker-Cura.spec.jinja 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # -*- mode: python ; coding: utf-8 -*-
  2. import os
  3. from pathlib import Path
  4. from PyInstaller.utils.hooks import collect_all
  5. datas = {{ datas }}
  6. binaries = {{ binaries }}
  7. hiddenimports = {{ hiddenimports }}
  8. {% for value in collect_all %}tmp_ret = collect_all('{{ value }}')
  9. datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
  10. {% endfor %}
  11. # Add dynamic libs in the venv bin/Script Path. This is needed because we might copy some additional libs
  12. # e.q.: OpenSSL 1.1.1l in that directory with a separate:
  13. # `conan install openssl@1.1.1l -g deploy && cp openssl/bin/*.so cura_inst/bin`
  14. binaries.extend([(str(bin), ".") for bin in Path(r"{{ venv_script_path }}").glob("*.so*")])
  15. binaries.extend([(str(bin), ".") for bin in Path(r"{{ venv_script_path }}").glob("*.dll")])
  16. binaries.extend([(str(bin), ".") for bin in Path(r"{{ venv_script_path }}").glob("*.dylib")])
  17. block_cipher = None
  18. a = Analysis(
  19. [{{ entrypoint }}],
  20. pathex=[],
  21. binaries=binaries,
  22. datas=datas,
  23. hiddenimports=hiddenimports,
  24. hookspath=[],
  25. hooksconfig={},
  26. runtime_hooks=[],
  27. excludes=[],
  28. win_no_prefer_redirects=False,
  29. win_private_assemblies=False,
  30. cipher=block_cipher,
  31. noarchive=False
  32. )
  33. pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
  34. exe = EXE(
  35. pyz,
  36. a.scripts,
  37. [],
  38. exclude_binaries=True,
  39. name=r'{{ name }}',
  40. debug=False,
  41. bootloader_ignore_signals=False,
  42. strip={{ strip }},
  43. upx={{ upx }},
  44. console=False,
  45. disable_windowed_traceback=False,
  46. argv_emulation=False,
  47. target_arch={{ target_arch }},
  48. codesign_identity=os.getenv('CODESIGN_IDENTITY', None),
  49. entitlements_file={{ entitlements_file }},
  50. icon={{ icon }},
  51. contents_directory='.'
  52. )
  53. coll = COLLECT(
  54. exe,
  55. a.binaries,
  56. a.zipfiles,
  57. a.datas,
  58. strip=False,
  59. upx=True,
  60. upx_exclude=[],
  61. name=r'{{ name }}'
  62. )
  63. {% if macos == true %}
  64. app = BUNDLE(
  65. coll,
  66. name='{{ display_name }}.app',
  67. icon={{ icon }},
  68. bundle_identifier={{ osx_bundle_identifier }} + "_" + '{{ display_name }}'.replace(" ", "_") + "_" {{ short_version }},
  69. version={{ version }},
  70. info_plist={
  71. 'CFBundleDisplayName': '{{ display_name }}',
  72. 'NSPrincipalClass': 'NSApplication',
  73. 'CFBundleDevelopmentRegion': 'English',
  74. 'CFBundleExecutable': '{{ name }}',
  75. 'CFBundleInfoDictionaryVersion': '6.0',
  76. 'CFBundlePackageType': 'APPL',
  77. 'CFBundleVersionString': {{ version }},
  78. 'CFBundleShortVersionString': {{ short_version }},
  79. 'CFBundleURLTypes': [{
  80. 'CFBundleURLName': '{{ display_name }}',
  81. 'CFBundleURLSchemes': ['cura', 'slicer'],
  82. }],
  83. 'CFBundleDocumentTypes': [{
  84. 'CFBundleTypeRole': 'Viewer',
  85. 'CFBundleTypeExtensions': ['stl', 'obj', '3mf', 'gcode', 'ufp'],
  86. 'CFBundleTypeName': 'Model Files',
  87. }]
  88. },
  89. )
  90. {% endif %}