]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blame_incremental - music_sampler.spec
Improve error message and handling
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler.spec
... / ...
CommitLineData
1# -*- mode: python -*-
2import os
3import setuptools_scm
4from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\
5 hookspath, runtime_hooks
6
7import importlib.machinery
8sysfont = importlib.machinery\
9 .SourceFileLoader('sysfont', os.getcwd() + '/music_sampler/sysfont.py') \
10 .load_module()
11
12excluded_and_hidden_modules = get_deps_minimal(
13 video=None,
14 camera=None,
15 audio=None,
16 clipboard=None,
17 spelling=None)
18
19excluded_and_hidden_modules['hiddenimports'] += [
20 'six',
21 'packaging',
22 'packaging.version',
23 'packaging.specifiers',
24 'packaging.requirements' ]
25
26commit_message = setuptools_scm.get_version()
27pyinstaller_file = open(".pyinstaller_commit", "w")
28pyinstaller_file.write(commit_message)
29pyinstaller_file.close()
30
31data = [
32 ('music_sampler/music_sampler.kv', '.'),
33 ('.pyinstaller_commit', '.')
34]
35
36a = Analysis(['run.py'],
37 binaries=None,
38 datas=data,
39 hookspath=hookspath(),
40 runtime_hooks=runtime_hooks(),
41 **excluded_and_hidden_modules)
42
43for 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
51pyz = PYZ(a.pure, a.zipped_data)
52
53# Single file
54exe = 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')