My favorites | Sign in
Logo
                
Code license: New BSD License
Labels: Stub, Python, Mac, Launcher, Bundle
Links:
Feeds:
People details
Project owners:
  0xcafefeed

Description

Embedding the Python Interpreter to make Mac OS X Applications bundle. Python Application Stub is similar to Apple’s Java Application Stub and uses the Core Foundation to access to Mac OS X features.

Build on Leopard

%$ make CURRENT

This will produce FAT binaries containing i686, x86_64, ppc and ppc64 architectures, except for the main stub e.g PythonApplicationStub and PythonApplicationStub64 that you can find in PythonApplicationLauncher.framework/Resources/MacOS

%$ make HOST_LEOPARD_FAT

This will produce FAT binaries containing i686 and ppc architectures e.g 32-bit, all other targets are un-documentated and are under legacy support, to activate the internal debug mode you have to change build flags:

-Ddebug_trace=1 -Dmacroassert=1 -Dmacrolog=0

or

-Ddebug_trace=1 -Dmacroassert=0 -Dmacrolog=1

Overview

Thread-safe behaviour does not apply for versions inferior to 103.2, Thread-not-safe version, hold a copy of PythonApplicationLauncher framework into each bundle. The PythonApplicationLauncher framework (103.2 or later) can also be deployed at Application/Bundle level, but we prefer that you use "/Library/Frameworks" folder rather than "$BUNDLE_PATH/Contents/Frameworks" to store it, because we plan to add an auto-updater.

CFBundleExecutable, just to know

#include <PythonApplicationLauncher/PythonApplicationLauncher.h>

/*
* gcc PythonApplicationStub.c -o "${progname}" -framework PythonApplicationLauncher
*/
int main(int argc, const char * argv[])
{
  // argc and argv are forwarded to your "python main script/class" 
  return PythonApplicationStubMain(argc, (const char **) argv); // main thread
}

ASBundle (Application Stub Bundle), CFBundle properties we use

CFBundleExecutable, CFBundleName, CFBundleDisplayName, CFBundleIconFile, CFBundleVersion, CFBundleShortVersionString, CFBundleGetInfoString, NSHumanReadableCopyright, CFBundleHelpBookName.

Configurable through the Python Dictionary stored into the Info.plist file

Undocumented

Boolean Keys: UINotify , FSEvent , SimpleStub (avoid UINotify and FSEvent ), PrintDebug (private, internal), if there is no Python Dictionary stored into the Info.plist file the Application will start with simple default values and execute "Contents/Resources/Python/main.py", in the same way than a PyObjC stub, but, anyway faster and safer than a PyObjC stub, also, you may notice that a ClassPath entry can be set to a Zip'ed package; it can be an absolute path as well as a relative one.

...
  <key>Python</key>
  <dict>
    <key>Charset</key>
    <string>utf-8</string>
    <key>ClassPath</key>
    <array>
      <string>Contents/Resources/Python/ArchimadeCore</string>
      <string>Contents/Resources/Python/CFgedeon</string>
      <string>Contents/Resources/Python/NSAppKit.zip</string>
    </array>
    <key>MainClass</key>
    <string>Archimade</string>
    <key>OptimizeFlag</key>
    <integer>0</integer>
    <key>PrintDebug</key>
    <integer>1</integer>
    <key>WorkingDirectory</key>
    <string>Contents/Resources/Python</string>
  </dict>
...

Configurable and Optional









Hosted by Google Code