-
Notifications
You must be signed in to change notification settings - Fork 4
/
SecurePivxMasternodeTool.spec
155 lines (136 loc) · 5.11 KB
/
SecurePivxMasternodeTool.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# -*- mode: python -*-
import sys
import os.path as os_path
import simplejson as json
os_type = sys.platform
block_cipher = None
base_dir = os_path.dirname(os_path.realpath('__file__'))
def libModule(module, source, dest):
m = __import__(module)
module_path = os_path.dirname(m.__file__)
del m
print("libModule %s" % str(( os_path.join(module_path, source), dest )))
return ( os_path.join(module_path, source), dest )
# look for version string
version_str = ''
with open(os_path.join(base_dir, 'src', 'version.txt')) as version_file:
version_data = json.load(version_file)
version_file.close()
version_str = version_data["number"] + version_data["tag"]
add_files = [('src/version.txt', '.'), ('img', 'img')]
add_files.append( libModule('bitcoin', 'english.txt','bitcoin') )
add_files.append( libModule('trezorlib', 'coins.json', 'trezorlib') )
add_files.append( libModule('trezorlib', 'transport', 'trezorlib/transport') )
if os_type == 'win32':
import ctypes.util
l = ctypes.util.find_library('libusb-1.0.dll')
if l:
add_files.append( (l, '.') )
a = Analysis(['spmt.py'],
pathex=[base_dir, 'src', 'src/qt'],
binaries=[],
datas=add_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[ 'numpy',
'cryptography',
'lib2to3',
'pkg_resources',
'distutils',
'Crypto',
'pyi_rth_qt5',
'pytest',
'scipy',
'pycparser',
'pydoc',
'PyQt5.QtHelp',
'PyQt5.QtMultimedia',
'PyQt5.QtNetwork',
'PyQt5.QtOpenGL',
'PyQt5.QtPrintSupport',
'PyQt5.QtQml',
'PyQt5.QtQuick',
'PyQt5.QtQuickWidgets',
'PyQt5.QtSensors',
'PyQt5.QtSerialPort',
'PyQt5.QtSql',
'PyQt5.QtSvg',
'PyQt5.QtTest',
'PyQt5.QtWebEngine',
'PyQt5.QtWebEngineCore',
'PyQt5.QtWebEngineWidgets',
'PyQt5.QtXml',
'win32com',
'xml.dom.domreg',
],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.binaries,
a.zipfiles,
a.datas,
a.scripts,
#exclude_binaries=True,
name='SecurePivxMasternodeTool',
debug=False,
strip=False,
upx=False,
console=False,
icon=os_path.join(base_dir, 'img', 'spmt.%s' % ('icns' if os_type=='darwin' else 'ico')) )
#coll = COLLECT(exe,
# a.binaries,
# a.zipfiles,
# a.datas,
# strip=False,
# upx=True,
# name='app')
if os_type == 'darwin':
app = BUNDLE(exe,
name='SecurePivxMasternodeTool.app',
icon=os_path.join(base_dir, 'img', 'spmt.icns'),
bundle_identifier=None,
info_plist={'NSHighResolutionCapable': 'True'})
# Prepare bundles
dist_path = os_path.join(base_dir, 'dist')
app_path = os_path.join(dist_path, 'app')
os.chdir(dist_path)
# Copy Readme Files
#from shutil import copyfile, copytree
#print('Copying README.md')
#copyfile(os_path.join(base_dir, 'README.md'), 'README.md')
#copytree(os_path.join(base_dir, 'docs'), 'docs')
if os_type == 'win32':
os.chdir(base_dir)
# Rename dist Dir
dist_path_win = os_path.join(base_dir, 'SPMT-v' + version_str + '-Win64')
os.rename(dist_path, dist_path_win)
# Create NSIS compressed installer
print('Creating Windows installer (requires NSIS)')
os.system('\"c:\\program files (x86)\\NSIS\\makensis.exe\" %s' % os.path.join(base_dir, 'setup.nsi'))
if os_type == 'linux':
os.chdir(base_dir)
# Rename dist Dir
dist_path_linux = os_path.join(base_dir, 'SPMT-v' + version_str + '-gnu_linux')
os.rename(dist_path, dist_path_linux)
# Compress dist Dir
print('Compressing Linux App Folder')
os.system('tar -zcvf %s -C %s %s' % ('SPMT-v' + version_str + '-x86_64-gnu_linux.tar.gz',
base_dir, 'SPMT-v' + version_str + '-gnu_linux'))
if os_type == 'darwin':
os.chdir(base_dir)
# Rename dist Dir
dist_path_mac = os_path.join(base_dir, 'SPMT-v' + version_str + '-MacOSX')
os.rename(dist_path, dist_path_mac)
# Remove 'app' folder
print("Removin 'app' folder")
os.chdir(dist_path_mac)
os.system('rm -rf app')
os.chdir(base_dir)
# Compress dist Dir
print('Compressing Mac App Folder')
os.system('tar -zcvf %s -C %s %s' % ('SPMT-v' + version_str + '-MacOSX.tar.gz',
base_dir, 'SPMT-v' + version_str + '-MacOSX'))