Friday, January 23, 2015

Continuing to hammer on pyinstaller; Word panel

I spent the morning processing and printing pictures from a family collection so my wife can make display panels for a relative's funeral. But after lunch I was able to spend a couple of hours adding the customized Edit menu to the PPQT Words panel. I can wrap that up tomorrow.

For the, I don't know, fifth? day in a row, I read webcomics using Cobro in its WebEngine version. It's pretty smooth. All comics load; no messages of any kind to the console. Quite a pleasant experience. If I can find a way to bundle this as a self-contained app, it would be worth distributing.

With that in mind, and since nothing was new from Nuitka development, I resumed attempting to make PyInstaller work. In response to yesterday's query, I had one comment that libqcocoa.dylib should be included in the bundle. So I verified that it wasn't; then I took steps to make sure it was; then I wrote the following email, which I quote in full to show how thorough I'm being.

The file libqcocoa.dylib does exist in the Qt distribution.

Definitely the stock pyinstaller -w operation does not include it or anything else with a name like "*coco*" in the output bundle.

I modified the spec file to read as follows:

    # -*- mode: python -*-
    a = Analysis(['/Users/dcortesi/Dropbox/David/PPQT/CoBro/cobro.py'],
                 pathex=['/Users/dcortesi/Desktop/scratch/pyinst'],
                 hiddenimports=[],
                 hookspath=None,
                 runtime_hooks=None)
    pyz = PYZ(a.pure)

    exe = EXE(pyz,
              a.scripts,
              exclude_binaries=True,
              name='cobro',
              debug=False,
              strip=None,
              upx=True,
              console=False , icon='cobro.icns')

    a.binaries += [ ('cocoa', '/Developer/5.4/clang_64/plugins/platforms/libqcocoa.dylib', 'BINARY' ) ]
    a.binaries += [ ('libqcocoa', '/Developer/5.4/clang_64/plugins/platforms/libqcocoa.dylib', 'BINARY' ) ]
    a.binaries += [ ('libqcocoa.dylib', '/Developer/5.4/clang_64/plugins/platforms/libqcocoa.dylib', 'BINARY' ) ]

    coll = COLLECT(exe,
                   a.binaries,
                   a.zipfiles,
                   a.datas,
                   strip=None,
                   upx=True,
                   name='cobro')
    app = BUNDLE(coll,
                 name='cobro.app',
                 icon='cobro.icns')

When this is run, the desired lib does appear, in three copies under three names, in the cobro.app bundle:

    $ find dist/cobro.app -name '*coco*'
    dist/cobro.app/Contents/MacOS/cocoa
    dist/cobro.app/Contents/MacOS/libqcocoa
    dist/cobro.app/Contents/MacOS/libqcocoa.dylib

Nevertheless, when the app is executed it dies as before with the abort,

This application failed to start because it could not find or load the Qt platform plugin "cocoa".

I go into the "hooks" folder and execute cat hook-PyQt5* | grep cocoa and get no output, so it is not mentioned in a hook. (Nor in PyQt4*)

Any ideas welcome...

No comments: