From 858e93befd7b0cadf11227364832d89e71bfffb1 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 24 Mar 2016 15:29:21 +0100 Subject: [PATCH] Update build scripts - PyInstaller script (e.g. for Windows) - build_osx.sh for OSX --- pyinstaller/bitmessagemain.spec | 58 +++++++++++++++++++++++++++++++++ src/build_osx.py | 1 + 2 files changed, 59 insertions(+) create mode 100644 pyinstaller/bitmessagemain.spec diff --git a/pyinstaller/bitmessagemain.spec b/pyinstaller/bitmessagemain.spec new file mode 100644 index 00000000..0b41bb00 --- /dev/null +++ b/pyinstaller/bitmessagemain.spec @@ -0,0 +1,58 @@ +srcPath = "C:\\src\\PyBitmessage\\src\\" +qtPath = "C:\\Qt\\4.8.6\\" +openSSLPath = "C:\\OpenSSL-1.0.2e\\" +outPath = "C:\\src\\PyInstaller\\bitmessagemain" + +# -*- mode: python -*- +a = Analysis([srcPath + 'bitmessagemain.py'], + pathex=[outPath], + hiddenimports=[], + hookspath=None, + runtime_hooks=None) + +# fix duplicates +for d in a.datas: + if 'pyconfig' in d[0]: + a.datas.remove(d) + break + +def addTranslations(): + import os + extraDatas = [] + for file in os.listdir(srcPath + 'translations'): + if file[-3:] != ".qm": + continue + extraDatas.append(('translations\\'+file, srcPath + 'translations\\' + file, 'DATA')) + for file in os.listdir(qtPath + 'translations'): + if file[0:3] != "qt_" or file[5:8] != ".qm": + continue + extraDatas.append(('translations\\'+file, qtPath + 'translations\\' + file, 'DATA')) + return extraDatas + +def addUIs(): + import os + extraDatas = [] + for file in os.listdir(srcPath + 'bitmessageqt'): + if file[-3:] != ".ui": + continue + extraDatas.append(('ui\\'+file, srcPath + 'bitmessageqt\\' + file, 'DATA')) + return extraDatas + +# append the translations directory +a.datas += addTranslations() +a.datas += addUIs() + +a.binaries.append(('msvcr120.dll', 'C:\\WINDOWS\\system32\\msvcr120.dll', 'BINARY')) + +pyz = PYZ(a.pure) +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + a.binaries + [('libeay32.dll', openSSLPath + 'libeay32.dll', 'BINARY'), ('bitmsghash\\bitmsghash32.dll', srcPath + 'bitmsghash\\bitmsghash32.dll', 'BINARY'), ('bitmsghash\\bitmsghash.cl', srcPath + 'bitmsghash\\bitmsghash.cl', 'BINARY'), ('sslkeys\\cert.pem', srcPath + 'sslkeys\\cert.pem', 'BINARY'), ('sslkeys\\key.pem', srcPath + 'sslkeys\\key.pem', 'BINARY')], + name='Bitmessage.exe', + debug=False, + strip=None, + upx=False, + console=False, icon= srcPath + 'images\\can-icon.ico') diff --git a/src/build_osx.py b/src/build_osx.py index fb81d4d0..1d8f470e 100644 --- a/src/build_osx.py +++ b/src/build_osx.py @@ -11,6 +11,7 @@ DATA_FILES = [ ('', ['sslkeys', 'images']), ('bitmsghash', ['bitmsghash/bitmsghash.cl', 'bitmsghash/bitmsghash.so']), ('translations', glob('translations/*.qm')), + ('ui', glob('bitmessageqt/*.ui')), ('translations', glob(str(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)) + '/qt_??.qm')), ('translations', glob(str(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)) + '/qt_??_??.qm')), ]