0

So I'm trying to put together an auto-update functionality for my standalone OSX Python application, that's built on PyObjC. It works great simply packaging it via py2app, but I'm attemping to freeze it with Esky as part of an effort to implement the update feature.

As far as I can tell it's my setup.py formatting for Esky. I'm not sure exactly how to tell Esky to pass on the name of my .Xib file to py2app. Here's what my direct py2app setup.py looks like, successfully including the required .Xib file for the GUI:

setup.py for Py2app

from setuptools import setup

APP = ['MyApp.py']
DATA_FILES = ['MyApp.xib']
OPTIONS = {'argv_emulation': False, 'packages' : ['PIL']}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    iconfile="MyApp.icns"
)

Looking around at other people's posts, it looks like you can pass settings to py2app via the slightly differently structured Esky setup.py, but I can't for the life of me figure out the exact structure of the arguments to pass the .Xib file to py2app, from Esky.

setup.py for Esky

from esky import bdist_esky
from distutils.core import setup

setup(name="MyApp",
      version="1.3.3",
      iconfile="MyApp.icns",
      data_files=['MyApp.xib'],
      scripts=["MyApp.py","midheaven.py"],
      options={"bdist_esky":{
      "includes":["PIL"],
      "excludes":['pydoc'],
      "freezer_module": "py2app",
      "freezer_options": {
                "plist": {
                    'argv_emulation': False,
                    'packages': ['PIL'],
                },
                "data_files": ['MyApp.xib'],
            },
      },
      },

     )

Everything packages without an error, but of course if I try to run the Esky freeze of the app it crashes right away. I'm positive it's because it's not attaching the .Xib GUI properly. Anyone have experience with this, or ideas on how this should actually be formatted? Would absolutely love to figure this out and have it up on here for posterity.

tom f
  • 370
  • 3
  • 16

1 Answers1

0

You are correct esky does something different than what you might expect. Looking in the demo/tutorial folder is what got me on the right path.

setup(name="MyApp",
      data_files=[('', ['MyApp.xib']),
                 ('files', ['file1', 'file2']),
                 ('img', glob(r'.\img\*.*'))
                  ]
      ...

So you have a whole bunch of tuples, where the first entry is the path in your package to include the files and the second is an iterable of files to put there

You can remove the second instance of data_files that you have in the options dict.

Update

Try

from esky.bdist_esky import Executable

executables = [Executable('example_gui.py', icon='myico.ico', gui_only=True,)]  

setup(
    scripts = executables
    ...

  
Community
  • 1
  • 1
timeyyy
  • 654
  • 9
  • 20
  • So `[('this/is/the/include/path', ['MyApp.xib']), ` you mean? i'm actually still not having luck with it. I assume the path would be blank if the file is in the same directory as your application. – tom f Jul 03 '15 at 00:06
  • the first one is where you want the files to be put after installation, the first is the source location of the files relative to your setup file – timeyyy Jul 03 '15 at 06:58
  • @tomf can you update the code you are trying to run. – timeyyy Jul 05 '15 at 18:17
  • So I updated the setup.py to look more like this: `setup(name="MyApp", version="1.3.3", iconfile="MyApp.icns", data_files=[('', ['MyApp.xib'])], scripts=["MyApp.py","main.py"], options={"bdist_esky":{ "excludes":['pydoc']}, 'py2app':{'argv_emulation': False, 'packages' : ['PIL']} }, )` with the same results. – tom f Jul 06 '15 at 19:10
  • is your .Xib file included where it should be? Try updating the scripts and removing the incofile keyword from your setup – timeyyy Jul 08 '15 at 08:18