X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=music_sampler.spec;h=5549b767f957bf77f38eb89c7dd11edb6ba8a84f;hb=e257f4d9e3b8647c3470a1450ccdcea33583419c;hp=912edb788ae0b7f1b0d55de1c24ba05d6ae7f85f;hpb=956ce6fd3e47b2536f57f3359ebff26850f30aea;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/music_sampler.spec b/music_sampler.spec index 912edb7..5549b76 100644 --- a/music_sampler.spec +++ b/music_sampler.spec @@ -1,35 +1,68 @@ # -*- mode: python -*- +import os +import setuptools_scm +from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal,\ + hookspath, runtime_hooks -block_cipher = None +import importlib.machinery +sysfont = importlib.machinery\ + .SourceFileLoader('sysfont', os.getcwd() + '/music_sampler/sysfont.py') \ + .load_module() -a = Analysis(['music_sampler.py'], +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', '.') +] + +a = Analysis(['run.py'], binaries=None, - datas=[ - ('config.yml', '.'), - ('fonts/*', 'fonts') - ], - hiddenimports=[ - 'six', - 'packaging', - 'packaging.version', - 'packaging.specifiers', - 'packaging.requirements' - ], - hookspath=[], - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher) -pyz = PYZ(a.pure, a.zipped_data, - cipher=block_cipher) -exe = EXE(pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - name='music_sampler', - debug=False, - strip=False, - upx=True, - console=True ) + datas=data, + hookspath=hookspath(), + runtime_hooks=runtime_hooks(), + **excluded_and_hidden_modules) + +for fontname, style in [("Ubuntu", sysfont.STYLE_NORMAL), ("Ubuntu", sysfont.STYLE_BOLD), ("Symbola", sysfont.STYLE_NONE)]: + 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')