]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blame - music_sampler.spec
Use setuptools_scm to determinate project version
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler.spec
CommitLineData
d8ab67c7 1# -*- mode: python -*-
cc008de4 2import os
e257f4d9 3import setuptools_scm
2e404903
IB
4from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\
5 hookspath, runtime_hooks
d8ab67c7 6
35bde798
IB
7import importlib.machinery
8sysfont = importlib.machinery\
63ba5a8d 9 .SourceFileLoader('sysfont', os.getcwd() + '/music_sampler/sysfont.py') \
35bde798
IB
10 .load_module()
11
2e404903
IB
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' ]
d8ab67c7 25
e257f4d9 26commit_message = setuptools_scm.get_version()
cc008de4
IB
27pyinstaller_file = open(".pyinstaller_commit", "w")
28pyinstaller_file.write(commit_message)
29pyinstaller_file.close()
30
35bde798 31data = [
6ebe6247 32 ('music_sampler/music_sampler.kv', '.'),
35bde798
IB
33 ('.pyinstaller_commit', '.')
34]
35
6ebe6247 36a = Analysis(['run.py'],
d8ab67c7 37 binaries=None,
35bde798 38 datas=data,
d8046b94
IB
39 hookspath=hookspath(),
40 runtime_hooks=runtime_hooks(),
41 **excluded_and_hidden_modules)
35bde798
IB
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
d8046b94 51pyz = PYZ(a.pure, a.zipped_data)
1bf9e494
IB
52
53# Single file
2e404903
IB
54exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas,
55 name='music_sampler')
1bf9e494
IB
56
57# Directory
2e404903
IB
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')