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