X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git;a=blobdiff_plain;f=music_sampler.spec;h=5a814643c600569179b24cf6be5e52904c04ce49;hp=591a6cf0cae30da1e4e9ce8780db5cd9263bd938;hb=HEAD;hpb=2e4049036ec4d90a9daeff606d821d2ac2d023ce diff --git a/music_sampler.spec b/music_sampler.spec index 591a6cf..844ac4b 100644 --- a/music_sampler.spec +++ b/music_sampler.spec @@ -1,8 +1,14 @@ # -*- 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, @@ -17,21 +23,37 @@ excluded_and_hidden_modules['hiddenimports'] += [ 'packaging.specifiers', 'packaging.requirements' ] -commit_message = os.popen('git log -1 --format="%h %ci"').read() +commit_message = setuptools_scm.get_version() pyinstaller_file = open(".pyinstaller_commit", "w") pyinstaller_file.write(commit_message) pyinstaller_file.close() -a = Analysis(['music_sampler.py'], - binaries=None, - datas=[ - ('fonts/*', 'fonts'), - ('music_sampler.kv', '.'), - ('.pyinstaller_commit', '.') - ], +data = [ + ('music_sampler/music_sampler.kv', '.'), + ('.pyinstaller_commit', '.'), + ('music_sampler/locales', 'locales') +] + +a = Analysis(['run.py'], + 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