forked from pk-hack/CoilSnake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CoilSnake.spec
111 lines (93 loc) · 2.36 KB
/
CoilSnake.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
# -*- mode: python ; coding: utf-8 -*-
import os
import glob
import platform
import shutil
import sys
import sysconfig
from setuptools.sandbox import run_setup
run_setup('setup.py', ['build_ext'])
debug = False
sys_platform = sys.platform
if sys_platform == 'win32':
sys_platform = sysconfig.get_platform()
if len(sys.argv) > 1 and sys.argv[1] == 'debug':
debug = True
hiddenimports = ['PIL._tkinter_finder']
with open(os.path.join("coilsnake", "assets", "modulelist.txt"), "r") as f:
for line in f:
line = line.rstrip("\n")
if line[0] == "#":
continue
module = "coilsnake.modules." + line
hiddenimports.append(module)
pyver = '{}.{}'.format(sys.version_info[0], sys.version_info[1])
binaries = [(
'build/lib.{}-{}/coilsnake/util/eb/native_comp.cp*'.format(
sys_platform if sys_platform != 'darwin' else 'macosx',
pyver
),
'coilsnake/util/eb'
)]
a = Analysis(
['script/gui.py'],
pathex = ['.'],
binaries = binaries,
datas = [('coilsnake/assets', 'coilsnake/assets')],
hiddenimports = hiddenimports,
hookspath = [],
runtime_hooks = [],
excludes = [
'_bz2',
'_ssl',
'_lzma',
'readline',
'termios',
'PIL._webp',
'PySide',
'PyQt4',
'PyQt5'
],
win_no_prefer_redirects = False,
win_private_assemblies = False,
cipher = None,
noarchive = False
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=None
)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='CoilSnake',
debug=debug,
bootloader_ignore_signals=False,
strip=(sys.platform != 'win32'),
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=debug,
icon='coilsnake/assets/images/CoilSnake.ico',
manifest=None,
windowed=True
)
if platform.system() != 'Darwin':
exit()
app = BUNDLE(
exe,
name='CoilSnake.app',
icon='coilsnake/assets/images/CoilSnake.icns',
bundle_identifier='com.github.pkhack.CoilSnake'
)
# --- Workaround for https://github.com/pyinstaller/pyinstaller/issues/3820 ---
infile = glob.glob('/Library/Frameworks/Python.framework/Versions/{}/lib/tcl8/8.5/msgcat*.tm'.format(pyver))[0]
outdir = 'dist/CoilSnake.app/Contents/lib/tcl8/8.5'
os.makedirs(outdir, exist_ok=True)
shutil.copy(infile, outdir)
# -------------------