-
Notifications
You must be signed in to change notification settings - Fork 36
/
ossdbtoolsservice_main.spec
70 lines (60 loc) · 2.23 KB
/
ossdbtoolsservice_main.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
# ossdbtoolsservice_main.spec
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
import psycopg
import platform
block_cipher = None
def collect_files(src_folder, dest_folder, file_ext=None):
collected_files = []
for root, dirs, files in os.walk(src_folder):
for file in files:
if not file_ext or file.endswith(file_ext):
src_path = os.path.join(root, file)
rel_path = os.path.relpath(root, src_folder)
dest_path = os.path.join(dest_folder, rel_path)
collected_files.append((src_path, dest_path))
return collected_files
# Include psycopg dependencies
hiddenimports = collect_submodules('psycopg')
datas = collect_data_files('psycopg')
# Include ossdbtoolsservice data files
datas += collect_data_files('ossdbtoolsservice', include_py_files=False)
datas += [('./ossdbtoolsservice/language/completion/packages/pgliterals/pgliterals.json', 'language/completion/packages/pgliterals')]
# Include sql and macros files under pgsmo/objects
src_folder = './pgsmo/objects'
dest_folder = './pgsmo/objects'
sql_files = collect_files(src_folder, dest_folder, ".sql")
macro_files = collect_files(src_folder, dest_folder, ".macros")
datas += sql_files
datas += macro_files
# Include zlib library
if platform.system() == 'Darwin' and platform.machine() == 'arm64':
binaries = [
('/usr/local/opt/zlib/lib/libz.dylib', 'zlib'),
]
else:
binaries = []
a = Analysis(['ossdbtoolsservice/ossdbtoolsservice_main.py'],
pathex=['/Users/yimdaeun/Projects/pgtoolsservice/'],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='ossdbtoolsservice_main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True)