]>
Commit | Line | Data |
---|---|---|
1 | # -*- mode: python -*- | |
2 | import os | |
3 | from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\ | |
4 | hookspath, runtime_hooks | |
5 | ||
6 | import importlib.machinery | |
7 | sysfont = importlib.machinery\ | |
8 | .SourceFileLoader('sysfont', os.getcwd() + '/music_sampler/sysfont.py') \ | |
9 | .load_module() | |
10 | ||
11 | excluded_and_hidden_modules = get_deps_minimal( | |
12 | video=None, | |
13 | camera=None, | |
14 | audio=None, | |
15 | clipboard=None, | |
16 | spelling=None) | |
17 | ||
18 | excluded_and_hidden_modules['hiddenimports'] += [ | |
19 | 'six', | |
20 | 'packaging', | |
21 | 'packaging.version', | |
22 | 'packaging.specifiers', | |
23 | 'packaging.requirements' ] | |
24 | ||
25 | commit_message = os.popen('git log -1 --format="%h %ci"').read() | |
26 | pyinstaller_file = open(".pyinstaller_commit", "w") | |
27 | pyinstaller_file.write(commit_message) | |
28 | pyinstaller_file.close() | |
29 | ||
30 | data = [ | |
31 | ('music_sampler/music_sampler.kv', '.'), | |
32 | ('.pyinstaller_commit', '.') | |
33 | ] | |
34 | ||
35 | a = Analysis(['run.py'], | |
36 | binaries=None, | |
37 | datas=data, | |
38 | hookspath=hookspath(), | |
39 | runtime_hooks=runtime_hooks(), | |
40 | **excluded_and_hidden_modules) | |
41 | ||
42 | for fontname, style in [("Ubuntu", sysfont.STYLE_NORMAL), ("Ubuntu", sysfont.STYLE_BOLD), ("Symbola", sysfont.STYLE_NONE)]: | |
43 | font = sysfont.get_font(fontname, style=style) | |
44 | a.datas.append(( | |
45 | 'fonts/{}_{}.ttf'.format(fontname, style), | |
46 | font[4], | |
47 | 'DATA' | |
48 | )) | |
49 | ||
50 | pyz = PYZ(a.pure, a.zipped_data) | |
51 | ||
52 | # Single file | |
53 | exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, | |
54 | name='music_sampler') | |
55 | ||
56 | # Directory | |
57 | # exe = EXE(pyz, a.scripts, | |
58 | # exclude_binaries=True, | |
59 | # name='music_sampler_dir', | |
60 | # debug=False, | |
61 | # strip=False, | |
62 | # upx=True, | |
63 | # console=True) | |
64 | # coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, | |
65 | # strip=False, | |
66 | # upx=True, | |
67 | # name='music_sampler_dir') |