2017-02-27 13:02:37 +01:00
|
|
|
import ctypes
|
|
|
|
import os
|
|
|
|
import time
|
2019-09-16 12:50:40 +02:00
|
|
|
import sys
|
|
|
|
|
|
|
|
if ctypes.sizeof(ctypes.c_voidp) == 4:
|
|
|
|
arch=32
|
|
|
|
else:
|
|
|
|
arch=64
|
|
|
|
|
|
|
|
sslName = 'OpenSSL-Win%s' % ("32" if arch == 32 else "64")
|
|
|
|
site_root = os.path.abspath(HOMEPATH)
|
|
|
|
spec_root = os.path.abspath(SPECPATH)
|
2020-02-15 17:20:40 +01:00
|
|
|
cdrivePath = site_root[0:3]
|
|
|
|
srcPath = os.path.join(spec_root[:-20], "src")
|
|
|
|
qtBase = "PyQt4"
|
|
|
|
openSSLPath = os.path.join(cdrivePath, sslName)
|
|
|
|
msvcrDllPath = os.path.join(cdrivePath, "windows", "system32")
|
|
|
|
pythonDllPath = os.path.join(cdrivePath, "Python27")
|
|
|
|
outPath = os.path.join(spec_root, "bitmessagemain")
|
2019-09-16 12:50:40 +02:00
|
|
|
|
|
|
|
importPath = srcPath
|
|
|
|
sys.path.insert(0,importPath)
|
|
|
|
os.chdir(sys.path[0])
|
|
|
|
from version import softwareVersion
|
2017-02-27 13:02:37 +01:00
|
|
|
|
|
|
|
today = time.strftime("%Y%m%d")
|
|
|
|
snapshot = False
|
|
|
|
|
|
|
|
os.rename(os.path.join(srcPath, '__init__.py'), os.path.join(srcPath, '__init__.py.backup'))
|
|
|
|
|
|
|
|
# -*- mode: python -*-
|
2019-09-16 12:50:40 +02:00
|
|
|
a = Analysis(
|
2020-02-15 17:20:40 +01:00
|
|
|
[os.path.join(srcPath, 'bitmessagemain.py')],
|
2017-02-27 13:02:37 +01:00
|
|
|
pathex=[outPath],
|
2020-02-11 16:48:10 +01:00
|
|
|
hiddenimports=['bitmessageqt.languagebox', 'pyopencl','numpy', 'win32com' , 'setuptools.msvc' ,'_cffi_backend'],
|
2017-02-27 13:02:37 +01:00
|
|
|
hookspath=None,
|
2019-09-16 12:50:40 +02:00
|
|
|
runtime_hooks=None
|
|
|
|
)
|
2017-02-27 13:02:37 +01:00
|
|
|
|
|
|
|
os.rename(os.path.join(srcPath, '__init__.py.backup'), os.path.join(srcPath, '__init__.py'))
|
|
|
|
|
|
|
|
def addTranslations():
|
|
|
|
import os
|
|
|
|
extraDatas = []
|
2020-02-15 17:20:40 +01:00
|
|
|
for file_ in os.listdir(os.path.join(srcPath, 'translations')):
|
|
|
|
if file_[-3:] != ".qm":
|
2017-02-27 13:02:37 +01:00
|
|
|
continue
|
2020-02-15 17:20:40 +01:00
|
|
|
extraDatas.append((os.path.join('translations', file_),
|
|
|
|
os.path.join(srcPath, 'translations', file_), 'DATA'))
|
|
|
|
for libdir in sys.path:
|
|
|
|
qtdir = os.path.join(libdir, qtBase, 'translations')
|
|
|
|
if os.path.isdir(qtdir):
|
|
|
|
break
|
|
|
|
if not os.path.isdir(qtdir):
|
|
|
|
return extraDatas
|
|
|
|
for file_ in os.listdir(qtdir):
|
|
|
|
if file_[0:3] != "qt_" or file_[5:8] != ".qm":
|
2017-02-27 13:02:37 +01:00
|
|
|
continue
|
2020-02-15 17:20:40 +01:00
|
|
|
extraDatas.append((os.path.join('translations', file_),
|
|
|
|
os.path.join(qtdir, file_), 'DATA'))
|
2017-02-27 13:02:37 +01:00
|
|
|
return extraDatas
|
|
|
|
|
|
|
|
def addUIs():
|
|
|
|
import os
|
|
|
|
extraDatas = []
|
2020-02-15 17:20:40 +01:00
|
|
|
for file_ in os.listdir(os.path.join(srcPath, 'bitmessageqt')):
|
|
|
|
if file_[-3:] != ".ui":
|
2017-02-27 13:02:37 +01:00
|
|
|
continue
|
2020-02-15 17:20:40 +01:00
|
|
|
extraDatas.append((os.path.join('ui', file_), os.path.join(srcPath,
|
|
|
|
'bitmessageqt', file_), 'DATA'))
|
2017-02-27 13:02:37 +01:00
|
|
|
return extraDatas
|
|
|
|
|
|
|
|
# append the translations directory
|
|
|
|
a.datas += addTranslations()
|
|
|
|
a.datas += addUIs()
|
|
|
|
|
2019-09-16 12:50:40 +02:00
|
|
|
|
2020-02-15 17:20:40 +01:00
|
|
|
a.binaries += [('libeay32.dll', os.path.join(openSSLPath, 'libeay32.dll'), 'BINARY'),
|
|
|
|
('python27.dll', os.path.join(pythonDllPath, 'python27.dll'), 'BINARY'),
|
2019-09-16 12:50:40 +02:00
|
|
|
(os.path.join('bitmsghash', 'bitmsghash%i.dll' % (arch)), os.path.join(srcPath, 'bitmsghash', 'bitmsghash%i.dll' % (arch)), 'BINARY'),
|
|
|
|
(os.path.join('bitmsghash', 'bitmsghash.cl'), os.path.join(srcPath, 'bitmsghash', 'bitmsghash.cl'), 'BINARY'),
|
|
|
|
(os.path.join('sslkeys', 'cert.pem'), os.path.join(srcPath, 'sslkeys', 'cert.pem'), 'BINARY'),
|
|
|
|
(os.path.join('sslkeys', 'key.pem'), os.path.join(srcPath, 'sslkeys', 'key.pem'), 'BINARY')
|
|
|
|
]
|
2017-02-27 13:02:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
fname = 'Bitmessage_%s_%s.exe' % ("x86" if arch == 32 else "x64", softwareVersion)
|
|
|
|
if snapshot:
|
|
|
|
fname = 'Bitmessagedev_%s_%s.exe' % ("x86" if arch == 32 else "x64", today)
|
|
|
|
|
|
|
|
pyz = PYZ(a.pure)
|
|
|
|
exe = EXE(pyz,
|
|
|
|
a.scripts,
|
|
|
|
a.binaries,
|
|
|
|
a.zipfiles,
|
|
|
|
a.datas,
|
|
|
|
a.binaries,
|
2019-09-16 12:50:40 +02:00
|
|
|
[],
|
2017-02-27 13:02:37 +01:00
|
|
|
name=fname,
|
|
|
|
debug=False,
|
|
|
|
strip=None,
|
2020-02-15 17:20:40 +01:00
|
|
|
upx=False,
|
2020-02-11 16:48:10 +01:00
|
|
|
console=False, icon= os.path.join(srcPath, 'images', 'can-icon.ico'))
|
2019-09-16 12:50:40 +02:00
|
|
|
|
|
|
|
coll = COLLECT(exe,
|
|
|
|
a.binaries,
|
|
|
|
a.zipfiles,
|
|
|
|
a.datas,
|
|
|
|
strip=False,
|
2020-02-15 17:20:40 +01:00
|
|
|
upx=False,
|
2019-09-16 12:50:40 +02:00
|
|
|
name='main')
|
|
|
|
|