From 46a2c361dea30c7ef1ed9abd127185c0214d0c07 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sun, 19 Feb 2017 19:48:45 +0100 Subject: [PATCH] Building and msgpack fixes - Makefile typo - pyinstaller rewritten and fixed including and initialisation of messagetypes - msgpack decoding new message display fix --- packages/pyinstaller/bitmessagemain.spec | 26 ++++++++++++++++-------- src/bitmessageqt/account.py | 5 ++++- src/bitmsghash/Makefile | 2 +- src/messagetypes/__init__.py | 2 +- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/packages/pyinstaller/bitmessagemain.spec b/packages/pyinstaller/bitmessagemain.spec index bb16b911..c26325c3 100644 --- a/packages/pyinstaller/bitmessagemain.spec +++ b/packages/pyinstaller/bitmessagemain.spec @@ -6,12 +6,8 @@ qtPath = "C:\\Qt-4.8.7\\" openSSLPath = "C:\\OpenSSL-1.0.2j\\" outPath = "C:\\src\\PyInstaller-3.2.1\\bitmessagemain" -# -*- mode: python -*- -a = Analysis([srcPath + 'bitmessagemain.py'], - pathex=[outPath], - hiddenimports=['messagetypes'], - hookspath=None, - runtime_hooks=None) +messagetypes = [] +hiddenimports= [] # manually add messagetypes directory and its listing with open(os.path.join(srcPath, 'messagetypes.txt'), 'wt') as f: @@ -22,7 +18,19 @@ with open(os.path.join(srcPath, 'messagetypes.txt'), 'wt') as f: if splitted[1] != ".py": continue f.write(mt + "\n") - a.scripts.append((os.path.join('messagetypes', mt), os.path.join(srcPath, 'messagetypes', mt), 'PYMODULE')) + hiddenimports.append('messagetypes.' + splitted[0]) + messagetypes.append(mt) + +# -*- mode: python -*- +a = Analysis([srcPath + 'bitmessagemain.py'], + pathex=[outPath], + hiddenimports=hiddenimports, + hookspath=None, + runtime_hooks=None) + +for mt in messagetypes: + a.scripts.append((os.path.join('messagetypes', mt), os.path.join(srcPath, 'messagetypes', mt), 'PYMODULE')) + a.datas.append(('messagetypes.txt', os.path.join(srcPath, 'messagetypes.txt'), 'DATA')) # fix duplicates @@ -37,7 +45,7 @@ def addTranslations(): for file in os.listdir(srcPath + 'translations'): if file[-3:] != ".qm": continue - extraDatas.append((os.path.join('translations', file), os.path.join(srcPath, 'translations', file) 'DATA')) + extraDatas.append((os.path.join('translations', file), os.path.join(srcPath, 'translations', file), 'DATA')) for file in os.listdir(qtPath + 'translations'): if file[0:3] != "qt_" or file[5:8] != ".qm": continue @@ -80,4 +88,4 @@ exe = EXE(pyz, debug=False, strip=None, upx=False, - console=False, icon= os.path.join(srcPath, 'images', 'can-icon.ico') + console=False, icon= os.path.join(srcPath, 'images', 'can-icon.ico')) diff --git a/src/bitmessageqt/account.py b/src/bitmessageqt/account.py index 897cddef..03a22be0 100644 --- a/src/bitmessageqt/account.py +++ b/src/bitmessageqt/account.py @@ -128,7 +128,10 @@ class BMAccount(object): def parseMessage(self, toAddress, fromAddress, subject, message): self.toAddress = toAddress self.fromAddress = fromAddress - self.subject = subject + if isinstance(subject, unicode): + self.subject = str(subject) + else: + self.subject = subject self.message = message self.fromLabel = self.getLabel(fromAddress) self.toLabel = self.getLabel(toAddress) diff --git a/src/bitmsghash/Makefile b/src/bitmsghash/Makefile index 3d0f5d0a..56a6a3a9 100644 --- a/src/bitmsghash/Makefile +++ b/src/bitmsghash/Makefile @@ -6,7 +6,7 @@ else ifeq ($(UNAME_S),MINGW32_NT-6.1) CCFLAGS += -IC:\OpenSSL-1.0.2j-mingw\include -D_WIN32 -march=native LDFLAGS += -static-libgcc -LC:\OpenSSL-1.0.2j-mingw\lib -lwsock32 -o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a else - LDFLAGS += -lpthread -o bigmsghash.so + LDFLAGS += -lpthread -o bitmsghash.so endif all: bitmsghash.so diff --git a/src/messagetypes/__init__.py b/src/messagetypes/__init__.py index e22be925..e455c61b 100644 --- a/src/messagetypes/__init__.py +++ b/src/messagetypes/__init__.py @@ -31,7 +31,7 @@ def constructObject(data): mods = [] if paths.frozen is not None: with open(path.join(path.dirname(path.dirname(__file__)), 'messagetypes.txt'), 'rt') as f: - for m in f.readline(): + for m in f.readlines(): mods.append(m.rstrip()) else: mods = listdir(path.dirname(__file__))