-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathsakia.spec
100 lines (87 loc) · 3.64 KB
/
sakia.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
# -*- mode: python -*-
from PyInstaller.compat import is_darwin, is_win, is_linux
import ctypes
import subprocess
import os
block_cipher = None
a = Analysis(['src/sakia/main.py'],
pathex=['.'],
binaries=None,
datas=None,
hiddenimports=['six','packaging', 'packaging.version', 'packaging.specifiers'],
hookspath=['hooks'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
if is_darwin:
a.binaries = a.binaries - TOC([
('/usr/local/lib/libsodium.so', None, None),])
info = subprocess.check_output(["brew", "info", "libsodium"])
info = info.decode().splitlines(keepends=False)
if len(info) > 1:
library_path = info[3].split(" ")[0]
libsodium_path = os.path.join(library_path, "lib",
"libsodium.dylib")
a.binaries = a.binaries + TOC([('lib/libsodium.dylib', libsodium_path, 'BINARY')])
a.datas = a.datas + [('sakia/root_servers.yml', 'src/sakia/root_servers.yml', 'DATA')]
a.datas = a.datas + [('sakia/g1_licence.html', 'src/sakia/g1_licence.html', 'DATA')]
if is_linux:
libsodium_path = ctypes.util.find_library('libsodium.so')
if not libsodium_path:
if os.path.isfile('/usr/lib/x86_64-linux-gnu/libsodium.so.18.3.0'):
libsodium_path = "/usr/lib/x86_64-linux-gnu/libsodium.so.18.3.0"
if os.path.isfile('/usr/lib/x86_64-linux-gnu/libsodium.so.18.3.0'):
libsodium_path = "/usr/lib/x86_64-linux-gnu/libsodium.so.18.3.0"
a.binaries = a.binaries + TOC([('libsodium.so', libsodium_path, 'BINARY')])
a.datas = a.datas + [('sakia/root_servers.yml', 'src/sakia/root_servers.yml', 'DATA')]
a.datas = a.datas + [('sakia/g1_licence.html', 'src/sakia/g1_licence.html', 'DATA')]
if is_win:
a.binaries = a.binaries + TOC([('libsodium.dll', ctypes.util.find_library('libsodium.dll'), 'BINARY')])
a.datas = a.datas + [('sakia\\root_servers.yml', 'src\\sakia\\root_servers.yml', 'DATA')]
a.datas = a.datas + [('sakia\\g1_licence.html', 'src\\sakia\\g1_licence.html', 'DATA')]
for file in os.listdir(os.path.join("src", "sakia", "data", "repositories")):
if file.endswith(".sql"):
sql_file = os.path.basename(file)
if is_win:
a.datas = a.datas + [('sakia\\data\\repositories\\{:}'.format(sql_file),
'src\\sakia\\data\\repositories\\{:}'.format(sql_file), 'DATA')]
else:
a.datas = a.datas + [('sakia/data/repositories/{:}'.format(sql_file),
'src/sakia/data/repositories/{:}'.format(sql_file), 'DATA')]
print(a.binaries)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
if is_linux or is_darwin:
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='sakia.bin',
debug=True,
strip=False,
upx=True,
console=True,
icon='sakia.ico')
else:
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='sakia',
debug=True,
strip=False,
upx=True,
console=False,
icon='sakia.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='sakia')
if is_darwin:
app = BUNDLE(exe,
name='sakia.app',
icon='sakia.ico',
bundle_identifier=None,) # take care, info.plist will be overridden.