]>
Commit | Line | Data |
---|---|---|
d8ab67c7 | 1 | # -*- mode: python -*- |
cc008de4 | 2 | import os |
e257f4d9 | 3 | import setuptools_scm |
2e404903 IB |
4 | from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\ |
5 | hookspath, runtime_hooks | |
d8ab67c7 | 6 | |
35bde798 IB |
7 | import importlib.machinery |
8 | sysfont = importlib.machinery\ | |
dd25f8f0 | 9 | .SourceFileLoader('sysfont', os.getcwd()+'/music_sampler/sysfont.py') \ |
35bde798 IB |
10 | .load_module() |
11 | ||
2e404903 IB |
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' ] | |
d8ab67c7 | 25 | |
e257f4d9 | 26 | commit_message = setuptools_scm.get_version() |
cc008de4 IB |
27 | pyinstaller_file = open(".pyinstaller_commit", "w") |
28 | pyinstaller_file.write(commit_message) | |
29 | pyinstaller_file.close() | |
30 | ||
35bde798 | 31 | data = [ |
6ebe6247 | 32 | ('music_sampler/music_sampler.kv', '.'), |
6a327173 IB |
33 | ('.pyinstaller_commit', '.'), |
34 | ('music_sampler/locales', 'locales') | |
35bde798 IB |
35 | ] |
36 | ||
6ebe6247 | 37 | a = Analysis(['run.py'], |
d8ab67c7 | 38 | binaries=None, |
35bde798 | 39 | datas=data, |
d8046b94 IB |
40 | hookspath=hookspath(), |
41 | runtime_hooks=runtime_hooks(), | |
42 | **excluded_and_hidden_modules) | |
35bde798 | 43 | |
dd25f8f0 IB |
44 | fonts = [ |
45 | ("Ubuntu", sysfont.STYLE_NORMAL), | |
46 | ("Ubuntu", sysfont.STYLE_BOLD), | |
47 | ("Symbola", sysfont.STYLE_NONE) | |
48 | ] | |
49 | ||
50 | for fontname, style in fonts: | |
35bde798 IB |
51 | font = sysfont.get_font(fontname, style=style) |
52 | a.datas.append(( | |
53 | 'fonts/{}_{}.ttf'.format(fontname, style), | |
54 | font[4], | |
55 | 'DATA' | |
56 | )) | |
57 | ||
d8046b94 | 58 | pyz = PYZ(a.pure, a.zipped_data) |
1bf9e494 IB |
59 | |
60 | # Single file | |
2e404903 IB |
61 | exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, |
62 | name='music_sampler') | |
1bf9e494 IB |
63 | |
64 | # Directory | |
2e404903 IB |
65 | # exe = EXE(pyz, a.scripts, |
66 | # exclude_binaries=True, | |
67 | # name='music_sampler_dir', | |
68 | # debug=False, | |
69 | # strip=False, | |
70 | # upx=True, | |
71 | # console=True) | |
72 | # coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, | |
73 | # strip=False, | |
74 | # upx=True, | |
75 | # name='music_sampler_dir') |