Hi Wolf, 

There is currently no offical recommended way to package pyglet programs, 
but I have had good luck with PyInstaller. I have not tested this with 
AVbin, but you might have some success if you bundle the dlls. Please note 
that AVbin has been unmaintained for a while now. The upcoming 1.4 release 
of pyglet will include experimental support for FFmpeg, but that is not yet 
fully tested. 

Some things to consider: 
1. Make sure to use the pyglet.resource module for all of your media. 
2. Make sure the PyInstaller spec file knows about all of media files. 

Here is a working spec file (but not using AVbin). I have created a custom 
function (collect_assets) that creates a list of data files that 
PyInstaller should include in the package:

# -*- mode: python -*-

block_cipher = None

def collect_assets(asset_path):
    asset_files = []
    for dirpath, _, filenames in os.walk(asset_path):
        for file in filenames:
            orig_location = os.path.join(dirpath, file)
            asset_files.append((orig_location, dirpath))
            print("----> Adding data file: {}".format(orig_location))
    return asset_files


a = Analysis(['main.py'],
             pathex=['/home/ben/Documents/PycharmProjects/program_path'],   # 
added by pyinstaller
             binaries=[],
             datas=collect_assets('game/assets'),
             hiddenimports=[],
             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='ProgramName',
          debug=False,
          strip=False,
          upx=True,
          icon='game/assets/icon.ico',
          runtime_tmpdir=None,
          console=False)



On Wednesday, May 30, 2018 at 6:30:35 PM UTC+9, Wolf Weidner wrote:
>
> Dear Pyglet makers,
> thank you for this great libary!
>
> How whould I go about to package my program when it makes use of pyglets 
> ability to play mp3 through AVbin?
> With other words how do I package AVbin?
>
> I found this 3 year old topic 
> https://groups.google.com/forum/#!searchin/pyglet-users/package|sort:date/pyglet-users/DBdadWGtJkc/SL49BSbGWx0J
>
> but can not get a clear grasp of how to package. (e.g. with pyinstaller)
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to