-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.spec
139 lines (120 loc) · 3.77 KB
/
build.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
# -*- mode: python -*-
import os
import sys
sys.path += [ os.path.abspath(SPECPATH) ]
import bitsharesqt.version as version
EXE_NAME=version.UNIX_NAME
def bundle_version_file():
verfile = os.path.abspath(os.path.join(SPECPATH, "version.txt"))
with open(verfile, "w") as f:
f.write(version.git_version(version.VERSION))
bundle_version_file()
import platform
def is_os_64bit():
return platform.machine().endswith('64')
binaries = [ ]
hidden_imports = [ ]
def download_file(filename, url):
if not(os.path.isfile(filename)):
import requests
print("Downloading", url)
response = requests.get(url)
try:
html = response.text.startswith('<!DOCTYPE html>')
except:
html = False
if html:
raise Exception("Download error (some HTML is on the way)")
with open(filename, "wb") as f:
f.write(response.content)
return filename
def extract_file(archive, name):
import zipfile
with zipfile.ZipFile(archive, "r") as zip:
zip.extract(name)
def download_windows_openssl(i686=True):
if i686:
filename = 'openssl-1.0.2o-i386-win32.zip'
else:
filename = 'openssl-1.0.2o-x64_86-win64.zip'
# Picked from https://wiki.openssl.org/index.php/Binaries
url = 'https://indy.fulgan.com/SSL/' + filename
return download_file(filename, url)
if sys.platform == 'win32':
EXE_NAME=version.BUNDLE_NAME
i686 = not(is_os_64bit())
archive = download_windows_openssl( i686 )
#if i686:
dlls = [ 'libeay32.dll', 'ssleay32.dll' ]
for dll in dlls:
extract_file(archive, dll)
# binaries.append( (dll, '.') )
#else:
# pass
import ntpath
import imp
dll = imp.find_module('_scrypt')[1]
#binaries.append( (dll, '.') )
#
# NOTE: instead of adding to binaries, we just
# provide "hidden_imports: _scrypt" below
hidden_imports.append( '_scrypt' )
if sys.platform == "darwin":
hidden_imports.append( '_scrypt' )
# For PyQt5 >= 5.11, and pyinstaller not yet patched, we add this:
hidden_imports.append("PyQt5.sip")
datas=[('version.txt', '.')]
mgc_paths=['/opt/local/share/misc', # macports
'/usr/lib/file', '/usr/share/file', '/usr/local/share/file']
for path in mgc_paths:
p = os.path.join(path, "magic.mgc")
if os.path.isfile(p):
datas.append( (p, '.') )
break
print("DATAS:", datas)
block_cipher = None
a = Analysis(['citadel'],
pathex=[ ],
binaries=binaries,
datas=datas,#[('version.txt', '.')],
hiddenimports=hidden_imports,
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=EXE_NAME,
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=False,
icon='images/app.ico')
#coll = COLLECT(exe,
# a.binaries,
# a.zipfiles,
# a.datas,
# strip=False,
# upx=True,
# name='main')
app = BUNDLE(exe,
name=version.BUNDLE_NAME+'.app',
icon='build/app.icns',
bundle_identifier=None,
info_plist={
"CFBundleName": version.BUNDLE_NAME,
"CFBundleDisplayName": version.SHORT_DESCRIPTION,
"CFBundleIdentifier": "li.citadel.desktop",
"CFBundleShortVersionString": version.VERSION,
"NSPrincipalClass": "NSApplication",
"NSHighResolutionCapable": True,
}
)