I am not sure that my question / title is formulated completely correctly. I am working on OSX 10.6 and python 2.7.1. I used setuptools and py2app to create a .app that I can run with finder or from a terminal using open.
One of my goals for the program is to run quickly.
When I go to the build folder and run the python program directly using python, my window appears immediately. In less than 1 second. This is pretty consistent. But when I go to the dist folder and run .app (either from the search engine or with the open one), there is a pause of a few seconds before opening the window. About 4 - 5 seconds, quite consistently.
I thought that maybe this is due to the discovery, trying to find a document or something like that, so I tried this:
open -a testrun.app ""
.. and, of course, a window appears right now!
Is there something I need to do in setup.py or someplace to say that this is not a document oriented program?
A bit more detailed -
I am working on OSX 10.6.8 with Python 2.7.1 (as a system python). I tried some minor variations on this (2.6 with python_select, 2.7.3 in virtualenv ..), but so far this has not made any difference.
I created a simple .dylib (in objective-c) that exports a function that opens a window using cocoa. I created a very simple python extension module (in c) that has a function in it that calls the .dylib function.
(My plan is to create a shared / dynamic library on a platform in the platform language of the gui calls and related platform-specific calls, as well as a cross-platform c library that uses this and then creates high-level language extension modules, which make the c library available for these languages.)
I wrote a very simple python program that calls a c function. I wrote setup.py which creates everything and uses py2app to create .app.
Here's the build script for .dylib:
gcc -framework Cocoa -dynamiclib -x objective-c testlib.objc -current_version 1.0 -compatibility_version 1.0 -o libTestlib.1.dylib -arch i386 -arch x86_64
Here is setup.py:
from setuptools import setup, Extension APP = ['testrun.py'] DATA_FILES = [] OPTIONS = { 'argv_emulation': True, 'frameworks': ['/Users/shavais/scratch/objc/libTestlib.1.dylib'] } module1 = Extension( 'demo', sources = ['demo.c'], libraries = ['Testlib.1'], library_file_directories = ['/Users/shavais/scratch/objc'] ) setup( name = 'testrun', description = 'This is a testrun package', app = APP, data_files = DATA_FILES, options = {'py2app': OPTIONS}, setup_requires = ['py2app'], version = '1.0', py_modules = ['testrun'], ext_modules = [module1] )