]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blame - music_sampler.spec
Use pip setup file
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler.spec
CommitLineData
d8ab67c7 1# -*- mode: python -*-
cc008de4 2import os
2e404903
IB
3from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\
4 hookspath, runtime_hooks
d8ab67c7 5
35bde798
IB
6import importlib.machinery
7sysfont = importlib.machinery\
63ba5a8d 8 .SourceFileLoader('sysfont', os.getcwd() + '/music_sampler/sysfont.py') \
35bde798
IB
9 .load_module()
10
2e404903
IB
11excluded_and_hidden_modules = get_deps_minimal(
12 video=None,
13 camera=None,
14 audio=None,
15 clipboard=None,
16 spelling=None)
17
18excluded_and_hidden_modules['hiddenimports'] += [
19 'six',
20 'packaging',
21 'packaging.version',
22 'packaging.specifiers',
23 'packaging.requirements' ]
d8ab67c7 24
cc008de4
IB
25commit_message = os.popen('git log -1 --format="%h %ci"').read()
26pyinstaller_file = open(".pyinstaller_commit", "w")
27pyinstaller_file.write(commit_message)
28pyinstaller_file.close()
29
35bde798 30data = [
6ebe6247 31 ('music_sampler/music_sampler.kv', '.'),
35bde798
IB
32 ('.pyinstaller_commit', '.')
33]
34
6ebe6247 35a = Analysis(['run.py'],
d8ab67c7 36 binaries=None,
35bde798 37 datas=data,
d8046b94
IB
38 hookspath=hookspath(),
39 runtime_hooks=runtime_hooks(),
40 **excluded_and_hidden_modules)
35bde798
IB
41
42for 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
d8046b94 50pyz = PYZ(a.pure, a.zipped_data)
1bf9e494
IB
51
52# Single file
2e404903
IB
53exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas,
54 name='music_sampler')
1bf9e494
IB
55
56# Directory
2e404903
IB
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')