forked from Bertrand256/dash-masternode-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dash_masternode_tool.spec
120 lines (105 loc) · 3.72 KB
/
dash_masternode_tool.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
# -*- mode: python -*-
import sys
import os
import os.path
import platform
block_cipher = None
os_type = sys.platform
no_bits = platform.architecture()[0].replace('bit','')
version_str = ''
base_dir = os.path.dirname(os.path.realpath('__file__'))
# look for version string
with open(os.path.join(base_dir, 'version.txt')) as fptr:
for line in fptr:
parts = [elem.strip() for elem in line.split('=')]
if len(parts) == 2 and parts[0].lower() == 'version_str':
version_str = parts[1].strip("'")
break
add_files = [
('img/dmt.png','/img'),
('img/dash.ico','/img'),
('img/dmt.ico','/img'),
('img/arrow-right.ico','/img'),
('img/hw-lock.ico','/img'),
('img/hw-test.ico','/img'),
('img/dash-transfer.png','/img'),
('img/check.png','/img'),
('img/dollar.png','/img'),
('img/gear.png','/img'),
('img/hw.png','/img'),
('img/info.png','/img'),
('img/money-bag.png','/img'),
('img/sign.png','/img'),
('img/tools.png','/img'),
('img/uncheck.png','/img'),
('img/wallet.png','/img'),
('img/thumb-up.png','/img'),
('version.txt', '')
]
lib_path = next(p for p in sys.path if 'site-packages' in p)
if os_type == 'win32':
qt5_path = os.path.join(lib_path, 'PyQt5\\Qt\\bin')
sys.path.append(qt5_path)
# add file vcruntime140.dll manually, due to not including by pyinstaller
found = False
for p in os.environ["PATH"].split(os.pathsep):
file_name = os.path.join(p, "vcruntime140.dll")
if os.path.exists(file_name):
found = True
add_files.append((file_name, ''))
print('Adding file ' + file_name)
break
if not found:
raise Exception('File vcruntime140.dll not found in the system path.')
# add bitcoin library data file
add_files.append( (os.path.join(lib_path, 'bitcoin/english.txt'),'/bitcoin') )
a = Analysis(['src/dash_masternode_tool.py'],
pathex=[base_dir],
binaries=[],
datas=add_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
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.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='DashMasternodeTool',
debug=False,
strip=False,
upx=False,
console=False,
icon=os.path.join('img',('dmt.%s' % ('icns' if os_type=='darwin' else 'ico'))))
if os_type == 'darwin':
app = BUNDLE(exe,
name='DashMasternodeTool.app',
icon='img/dmt.icns',
bundle_identifier=None,
info_plist={
'NSHighResolutionCapable': 'True'
}
)
all_bin_dir = os.path.join(base_dir, 'dist', 'all')
if not os.path.exists(all_bin_dir):
os.makedirs(all_bin_dir)
# zip archives
dist_path = os.path.join(base_dir, DISTPATH)
print(dist_path)
print(all_bin_dir)
os.chdir(dist_path)
if os_type == 'win32':
print('Compressing Windows executable')
os.system('"C:\\Program Files\\7-Zip\\7z.exe" a %s %s -mx0' % (os.path.join(all_bin_dir, 'DashMasternodeTool_' + version_str + '.win' + no_bits + '.zip'), 'DashMasternodeTool.exe'))
elif os_type == 'darwin':
print('Compressing Mac executable')
os.system('zip -r "%s" "%s"' % (os.path.join(all_bin_dir, 'DashMasternodeTool_' + version_str + '.mac.zip'), 'DashMasternodeTool.app'))
elif os_type == 'linux':
print('Compressing Linux executable')
os.system('tar -zcvf %s %s' % (os.path.join(all_bin_dir, 'DashMasternodeTool_' + version_str + '.linux.tar.gz'), 'DashMasternodeTool'))