Example pyinstaller spec file

From Bitmessage Wiki
Jump to navigation Jump to search
# -*- mode: python -*-

block_cipher = None

a = Analysis(['..\\src\\bitmessagemain.py'],
             pathex=['C:\\example\\pyinstaller\\bitmessagemain'],
             binaries=None,
             datas=None,
             hiddenimports=[],
             hookspath=None,
             runtime_hooks=None,
             excludes=None,
             win_no_prefer_redirects=None,
             win_private_assemblies=None,
             cipher=block_cipher)

def addTranslations():
    import os
    extraDatas = []
    for file in os.listdir('src\\translations'):
        extraDatas.append(('translations\\'+file, 'src\\translations\\' + file, 'DATA'))
    return extraDatas

# append the translations directory
a.datas += addTranslations()

pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          a.binaries + [('libeay32.dll', 'c:\\windows\\system32\\libeay32.dll', 'BINARY')],
          name='bitmessagemain',
          debug=False,
          strip=None,
          upx=True,
          console=False , icon='src\\images\\can-icon.ico')