aboutsummaryrefslogtreecommitdiff
path: root/music_sampler.spec
blob: 5a814643c600569179b24cf6be5e52904c04ce49 (plain) (blame)
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
# -*- mode: python -*-
import os
import setuptools_scm
from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\
        hookspath, runtime_hooks

import importlib.machinery
sysfont = importlib.machinery\
        .SourceFileLoader('sysfont', os.getcwd()+'/music_sampler/sysfont.py') \
        .load_module()

excluded_and_hidden_modules = get_deps_minimal(
        video=None,
        camera=None,
        audio=None,
        clipboard=None,
        spelling=None)

excluded_and_hidden_modules['hiddenimports'] += [
        'six',
        'packaging',
        'packaging.version',
        'packaging.specifiers',
        'packaging.requirements' ]

commit_message = setuptools_scm.get_version()
pyinstaller_file = open(".pyinstaller_commit", "w")
pyinstaller_file.write(commit_message)
pyinstaller_file.close()

data = [
  ('music_sampler/music_sampler.kv', '.'),
  ('.pyinstaller_commit', '.'),
  ('music_sampler/locales', 'locales')
]

a = Analysis(['run.py'],
             binaries=None,
             datas=data,
             hookspath=hookspath(),
             runtime_hooks=runtime_hooks(),
             **excluded_and_hidden_modules)

fonts = [
  ("Ubuntu", sysfont.STYLE_NORMAL),
  ("Ubuntu", sysfont.STYLE_BOLD),
  ("Symbola", sysfont.STYLE_NONE)
]

for fontname, style in fonts:
    font = sysfont.get_font(fontname, style=style)
    a.datas.append((
        'fonts/{}_{}.ttf'.format(fontname, style),
        font[4],
        'DATA'
        ))

pyz = PYZ(a.pure, a.zipped_data)

# Single file
exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas,
        name='music_sampler')

# Directory
# exe = EXE(pyz, a.scripts,
#     exclude_binaries=True,
#     name='music_sampler_dir',
#     debug=False,
#     strip=False,
#     upx=True,
#     console=True)
# coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas,
#     strip=False,
#     upx=True,
#     name='music_sampler_dir')