Anonymous avatar Anonymous committed e15d16e

import

Comments (0)

Files changed (126)

+Installing
+==========
+
+From the py2app source directory, type::
+
+    python setup.py bdist_mpkg --open
+This is the MIT license.  This software may also be distributed under the same terms as Python (the PSF license).
+
+Copyright (c) 2004 Bob Ippolito.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+py2app 0.3.0
+------------
+
+py2app 0.3.0 is a major feature enhancements release.
+
+Functional changes:
+
+- New --xref (-x) option similar to py2exe's that produces
+  a list of modules and their interdependencies as a HTML
+  file
+- sys.executable now points to a regular Python interpreter
+  alongside the regular executable, so spawning sub-interpreters
+  should work much more reliably
+- Application bootstrap now detects paths containing ":"
+  and will provide a "friendly" error message instead of just
+  crashing <http://python.org/sf/1507224>.
+- Application bootstrap now sets PYTHONHOME instead of
+  a large PYTHONPATH
+- Application bootstrap rewritten in C that links to
+  CoreFoundation and Cocoa dynamically as needed,
+  so it doesn't imply any particular version of the runtime.
+- Documentation and examples changed to use setuptools
+  instead of distutils.core, which removes the need for
+  the py2app import
+- Refactored to use setuptools, distributed as an egg.
+- macholib, bdist_mpkg, modulegraph, and altgraph are now
+  separately maintained packages available on PyPI as eggs
+- macholib now supports little endian architectures,
+  64-bit Mach-O headers, and reading/writing of
+  multiple headers per file (fat / universal binaries)
+
+
+py2app 0.2.1
+------------
+
+py2app 0.2.1 is a minor bug fix release.
+
+Bug Fixes:
+
+- macholib.util.in_system_path understands SDKs now
+- DYLD_LIBRARY_PATH searching is fixed
+- Frameworks and excludes options should work again.
+
+
+py2app 0.2.0
+------------
+
+py2app 0.2.0 is a minor bug fix release.
+
+Functional changes:
+
+- New datamodels option to support CoreData.  Compiles
+  .xcdatamodel files and places them in the Resources dir
+  (as .mom).
+
+- New use-pythonpath option.  The py2app application bootstrap
+  will no longer use entries from PYTHONPATH unless this option
+  is used.
+
+- py2app now persists information about the build environment
+  (python version, executable, build style, etc.) in the
+  Info.plist and will clean the executable before rebuilding
+  if anything at all has changed.
+
+- bdist_mpkg now builds packages with the full platform info,
+  so that installing a package for one platform combination
+  will not look like an upgrade to another platform combination.
+
+Bug Fixes:
+
+- Fixed a bug in standalone building, where a rebuild could
+  cause an unlaunchable executable.
+
+- Plugin bootstrap should compile/link correctly
+  with gcc 4.
+
+- Plugin bootstrap no longer sets PYTHONHOME and will
+  restore PYTHONPATH after initialization.
+
+- Plugin bootstrap swaps out thread state upon plug-in
+  load if it is the first to initialize Python.  This
+  fixes threading issues.
+
+py2app 0.1.9
+------------
+
+py2app 0.1.9 is a minor bug fix release.
+
+Bugs fixed:
+
+- bdist_mpkg now builds zip files that are correctly unzipped
+  by all known tools.
+
+- The behavior of the bootstrap has changed slightly such that
+  ``__file__`` should now point to your main script, rather than
+  the bootstrap.  The main script has also moved to ``Resources``,
+  from ``Resources/Python``, so that ``__file__`` relative resource
+  paths should still work.
+
+py2app 0.1.8
+------------
+
+py2app 0.1.8 is a major enhancements release:
+
+Bugs fixed:
+
+- Symlinks in included frameworks should be preserved correctly
+  (fixes Tcl/Tk)
+- Fixes some minor issues with alias bundles
+- Removed implicit SpiderImagePlugin -> ImageTk reference in PIL
+  recipe
+- The ``--optimize`` option should work now
+- ``weakref`` is now included by default
+- ``anydbm``'s dynamic dependencies are now in the standard implies
+  list
+- Errors on app launch are brought to the front so the user does
+  not miss them
+- bdist_mpkg now compatible with pychecker (data_files had issues)
+
+Options changed:
+
+- deprecated ``--strip``, it is now on by default
+- new ``--no-strip`` option to turn off stripping of executables
+
+New features:
+
+- Looks for a hacked version of the PyOpenGL __init__.py so that
+  it doesn't have to include the whole package in order to get
+  at the stupid version file.
+- New ``loader_files`` key that a recipe can return in order to
+  ensure that non-code ends up in the .zip (the pygame recipe
+  uses this)
+- Now scans all files in the bundle and normalizes Mach-O load
+  commands, not just extensions.  This helps out when using the
+  ``--package`` option, when including frameworks that have plugins,
+  etc.
+- An embedded Python interpreter is now included in the executable
+  bundle (``sys.executable`` points to it), this currently only 
+  works for framework builds of Python
+- New ``macho_standalone`` tool
+- New ``macho_find`` tool
+- Major enhancements to the way plugins are built
+- bdist_mpkg now has a ``--zipdist`` option to build zip files
+  from the built package
+- The bdist_mpkg "Installed to:" description is now based on the
+  package install root, rather than the build root
+
+py2app 0.1.7
+------------
+
+`py2app`_ 0.1.7 is a bug fix release:
+
+- The ``bdist_mpkg`` script will now set up sys.path properly, for setup scripts
+  that require local imports.
+- ``bdist_mpkg`` will now correctly accept ``ReadMe``, ``License``, ``Welcome``,
+  and ``background`` files by parameter.
+- ``bdist_mpkg`` can now display a custom background again (0.1.6 broke this).
+- ``bdist_mpkg`` now accepts a ``build-base=`` argument, to put build files in
+  an alternate location.
+- ``py2app`` will now accept main scripts with a ``.pyw`` extension.
+- ``py2app``'s not_stdlib_filter will now ignore a ``site-python`` directory as
+  well as ``site-packages``.
+- ``py2app``'s plugin bundle template no longer displays GUI dialogs by default,
+  but still links to ``AppKit``.
+- ``py2app`` now ensures that the directory of the main script is now added to
+  ``sys.path`` when scanning modules.
+- The ``py2app`` build command has been refactored such that it would be easier
+  to change its behavior by subclassing.
+- ``py2app`` alias bundles can now cope with editors that do atomic saves
+  (write new file, swap names with existing file).
+- ``macholib`` now has minimal support for fat binaries.  It still assumes big
+  endian and will not make any changes to a little endian header.
+- Add a warning message when using the ``install`` command rather than installing
+  from a package.
+- New ``simple/structured`` example that shows how you could package an
+  application that is organized into several folders.
+- New ``PyObjC/pbplugin`` Xcode Plug-In example.
+
+py2app 0.1.6
+------------
+
+Since I have been slacking and the last announcement was for 0.1.4, here are the 
+changes for the soft-launched releases 0.1.5 and 0.1.6:
+
+`py2app`_ 0.1.6 was a major feature enhancements release:
+
+- ``py2applet`` and ``bdist_mpkg`` scripts have been moved to Python modules
+  so that the functionality can be shared with the tools.
+- Generic graph-related functionality from ``py2app`` was moved to
+  ``altgraph.ObjectGraph`` and ``altgraph.GraphUtil``.
+- ``bdist_mpkg`` now outputs more specific plist requirements
+  (for future compatibility).
+- ``py2app`` can now create plugin bundles (MH_BUNDLE) as well as executables.
+  New recipe for supporting extensions built with `sip`_, such as `PyQt`_.  Note that
+  due to the way that `sip`_ works, when one sip-based extension is used, *all*
+  sip-based extensions are included in your application.  In practice, this means
+  anything provided by `Riverbank`_, I don't think anyone else uses `sip`_ (publicly).
+- New recipe for `PyOpenGL`_.  This is very naive and simply includes the whole
+  thing, rather than trying to monkeypatch their brain-dead
+  version acquisition routine in ``__init__``.
+- Bootstrap now sets ``ARGVZERO`` and ``EXECUTABLEPATH`` environment variables,
+  corresponding to the ``argv[0]`` and the ``_NSGetExecutablePath(...)`` that the
+  bundle saw.  This is only really useful if you need to relaunch your own
+  application.
+- More correct ``dyld`` search behavior.
+- Refactored ``macholib`` to use ``altgraph``, can now generate `GraphViz`_ graphs
+  and more complex analysis of dependencies can be done.
+- ``macholib`` was refactored to be easier to maintain, and the structure handling
+  has been optimized a bit.
+- The few tests that there are were refactored in `py.test`_ style.
+- New `PyQt`_ example.
+- New `PyOpenGL`_ example.
+
+See also:
+
+- http://mail.python.org/pipermail/pythonmac-sig/2004-December/012272.html
+
+.. _`py.test`: http://codespeak.net/py/current/doc/test.html
+.. _`PyOpenGL`: http://pyopengl.sourceforge.net/
+.. _`Riverbank`: http://www.riverbankcomputing.co.uk/
+.. _`sip`: http://www.riverbankcomputing.co.uk/sip/index.php
+.. _`PyQt`: http://www.riverbankcomputing.co.uk/pyqt/index.php
+.. _`docutils`: http://docutils.sf.net/
+.. _`setuptools`: http://cvs.eby-sarna.com/PEAK/setuptools/
+
+py2app 0.1.5
+------------
+
+`py2app`_ 0.1.5 is a major feature enhancements release:
+
+- Added a ``bdist_mpkg`` distutils extension, for creating Installer 
+  an metapackage from any distutils script.
+
+  - Includes PackageInstaller tool
+  - bdist_mpkg script
+  - setup.py enhancements to support bdist_mpkg functionality
+
+- Added a ``PackageInstaller`` tool, a droplet that performs the same function
+    as the ``bdist_mpkg`` script.
+- Create a custom ``bdist_mpkg`` subclass for `py2app`_'s setup script.
+- Source package now includes `PJE`_'s `setuptools`_ extension to distutils.
+- Added lots of metadata to the setup script.
+- ``py2app.modulegraph`` is now a top-level package, ``modulegraph``.
+- ``py2app.find_modules`` is now ``modulegraph.find_modules``.
+- Should now correctly handle paths (and application names) with unicode characters
+  in them.
+- New ``--strip`` option for ``py2app`` build command, strips all Mach-O files 
+  in output application bundle.
+- New ``--bdist-base=`` option for ``py2app`` build command, allows an alternate
+  build directory to be specified.
+- New `docutils`_ recipe.
+  Support for non-framework Python, such as the one provided by `DarwinPorts`_.
+
+See also:
+
+- http://mail.python.org/pipermail/pythonmac-sig/2004-October/011933.html
+
+.. _`py.test`: http://codespeak.net/py/current/doc/test.html
+.. _`GraphViz`: http://www.pixelglow.com/graphviz/
+.. _`PyOpenGL`: http://pyopengl.sourceforge.net/
+.. _`Riverbank`: http://www.riverbankcomputing.co.uk/
+.. _`sip`: http://www.riverbankcomputing.co.uk/sip/index.php
+.. _`PyQt`: http://www.riverbankcomputing.co.uk/pyqt/index.php
+.. _`DarwinPorts`: http://darwinports.opendarwin.org/
+.. _`docutils`: http://docutils.sourceforge.net/
+.. _`setuptools`: http://cvs.eby-sarna.com/PEAK/setuptools/
+.. _`PJE`: http://dirtSimple.org/
+.. _`PyObjC`: http://pyobjc.sourceforge.net/
+
+py2app 0.1.4
+------------
+
+`py2app`_ 0.1.4 is a minor bugfix release:
+
+- The ``altgraph`` from 0.1.3 had a pretty nasty bug in it that prevented 
+  filtering from working properly, so I fixed it and bumped to 0.1.4.
+
+py2app 0.1.3
+------------
+
+`py2app`_ 0.1.3 is a refactoring and new features release:
+
+- ``altgraph``, my fork of Istvan Albert's `graphlib`_, is now part of the
+  distribution
+- ``py2app.modulegraph`` has been refactored to use ``altgraph``
+- `py2app`_ can now create `GraphViz`_ DOT graphs with the ``-g`` option
+  (`TinyTinyEdit example`_)
+- Moved the filter stack into ``py2app.modulegraph``
+- Fixed a bug that may have been in 0.1.2 where explicitly included packages
+  would not be scanned by ``macholib``
+- ``py2app.apptemplate`` now contains a stripped down ``site`` module as 
+  opposed to a ``sitecustomize``
+- Alias builds are now the only ones that contain the system and user 
+  ``site-packages`` directory in ``sys.path``
+- The ``pydoc`` recipe has been beefed up to also exclude ``BaseHTTPServer``,
+  etc.
+
+Known issues:
+
+- Commands marked with XXX in the help are not implemented
+- Includes *all* files from packages, it should be smart enough to strip
+  unused .py/.pyc/.pyo files (to save space, depending on which optimization
+  flag is used)
+- ``macholib`` should be refactored to use ``altgraph``
+- ``py2app.build_app`` and ``py2app.modulegraph`` should be refactored to
+  search for dependencies on a per-application basis
+
+.. _`graphlib`: http://www.personal.psu.edu/staff/i/u/iua1/python/graphlib/html/
+.. _`GraphViz`: http://www.research.att.com/sw/tools/graphviz/
+.. _`TinyTinyEdit example`: http://undefined.org/~bob/TinyTinyEdit.pdf
+
+py2app 0.1.2
+------------
+
+`py2app`_ 0.2 is primarily a bugfix release:
+
+- The encodings package now gets included in the zip file (saves space)
+- A copy of the Python interpreter is not included anymore in standalone
+  builds (saves space)
+- The executable bootstrap is now stripped by default (saves a little space)
+- ``sys.argv`` is set correctly now, it used to point to the executable, now
+  it points to the boot script.  This should enhance compatibility with some
+  applications.
+- Adds an "Alias" feature to modulegraph, so that ``sys.modules`` craziness
+  such as ``wxPython.wx -> wx`` can be accomodated (this particular craziness
+  is also now handled by default)
+- A ``sys.path`` alternative may be passed to ``find_modules`` now, though
+  this is not used yet
+- The ``Command`` instance is now passed to recipes instead of the
+  ``Distribution`` instance (though no recipes currently use either)
+- The post-filtering of modules and extensions is now generalized into a 
+  stack and can be modified by recipes
+- A `wxPython`_ example demonstrating how to package `wxGlade`_ has been 
+  added (this is a good example of how to write your own recipe, and how to
+  deal with complex applications that mix code and data files)
+- ``PyRuntimeLocations`` is now set to (only) the location of the current
+  interpreter's ``Python.framework`` for alias and semi-standalone build 
+  modes (enhances compatibility with extensions built with an unpatched
+  Makefile with Mac OS X 10.3's Python 2.3.0)
+
+Known issues:
+
+- Includes *all* files from packages, it should be smart enough to strip
+  unused .py/.pyc/.pyo files (to save space, depending on which optimization
+  flag is used).
+
+.. _`wxGlade`: http://wxglade.sourceforge.net/
+
+py2app 0.1.1
+------------
+
+`py2app`_ 0.1.1 is primarily a bugfix release:
+
+- Several problems related to Mac OS X 10.2 compatibility and standalone 
+   building have been resolved
+- Scripts that are not in the same directory as setup.py now work
+- A new recipe has been added that removes the pydoc -> Tkinter dependency
+- A recipe has been added for `py2app`_ itself
+- a `wxPython`_ example (superdoodle) has been added.  
+  Demonstrates not only how easy it is (finally!) to bundle 
+  `wxPython`_ applications, but also how one setup.py can 
+  deal with both `py2exe`_ and `py2app`_.
+- A new experimental tool, py2applet, has been added.  
+  Once you've built it (``python setup.py py2app``, of course), you should
+  be able to build simple applications simply by dragging your main script
+  and optionally any packages, data files, Info.plist and icon it needs.
+
+Known issues:
+
+- Includes *all* files from packages, it should be smart enough to strip
+  unused .py/.pyc/.pyo files (to save space, depending on which 
+  optimization flag is used).
+
+- The default ``PyRuntimeLocations`` can cause problems on machines that
+  have a /Library/Frameworks/Python.framework installed.  Workaround is
+  to set a plist that has the following key: 
+  ``PyRuntimeLocations=['/System/Library/Frameworks/Python.framework/Versions/2.3/Python']``
+  (this will be resolved soon)
+
+
+py2app 0.1
+----------
+
+(first public release)
+`py2app`_ is the bundlebuilder replacement we've all been waiting
+for.  It is implemented as a distutils command, similar to `py2exe`_.
+
+.. _`wxPython`: http://www.wxpython.org/
+.. _`py2app`: http://undefined.org/python/#py2app
+.. _`py2exe`: http://starship.python.net/crew/theller/py2exe/
+py2app is a suite of distutils extensions for Python
+development on the Mac.  The additional distutils
+commands (when imported) are as follows:
+
+py2app:
+
+    Converts python scripts into executable Mac OS X
+    applications, able to run without requiring an
+    existing python installation. This is a
+    replacement for bundlebuilder.
+
+bdist_mpkg:
+    
+    Extensible Mac OS X installer package creation
+    command.  By default it creates a self-contained
+    metapackage that separates your package's
+    components by install scheme (platlib, scripts,
+    headers, etc.).  It can be subclassed to provide
+    additional subpackages such as dependencies,
+    example code, documentation, applications, Xcode
+    templates, etc.
+
+The following pieces of the py2app suite may also be
+of general interest:
+    
+py2app.modulegraph:
+    
+    Cross-platform extremely flexible replacement for
+    modulefinder that uses a graph data structure to
+    track dependencies.
+    
+altgraph:
+
+    General purpose graph library, forked from graphlib.
+
+macholib:
+    
+    Mach-O header tool suite.  Can be used to analyze and
+    rewrite dependencies or symbols in Mach-O headers.
+    Primarily used as a replacement for otool
+    and install_name_tool.
+* EasyDialogs rsrc files
+* Refactor the Python bootstraps to compile the boot script and the main script
+* Put the main script in the zip, possibly the boot script too
+  Maybe not, this might break dirname(__name__) junk?
+  But not with the code object..
+* Use an egg runtime zipimport metapath replacement thing.
+* Clean the dist dir when switching build styles (alias vs. non-alias)
+* Write recipe for including wxWidgets .rsrc file
+* Fix wxPython 2.4.2.4
+* Pango?
+* Build DMG option for py2app and bdist_mpkg
+* Make it useful to build multiple apps/plugins in one setup()?
+* Allow bdist_mpkg to build .pyc/.pyo post-install
+* bdist_mpkg name to not include version
+* fix this::
+
+    TypeError: compile() expected string without null bytes
+
+    modulegraph.py(376)load_module()
+
+    -> co = compile (fp.read().replace("\r\n", "\n")+'\n',pathname, 'exec')
+
+* make py2applet --help work
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.3.7: http://docutils.sourceforge.net/" />
+<title>py2app - convert python scripts into standalone Mac OS X applications</title>
+<style type="text/css">
+
+/*
+:Author: David Goodger, Ian Bicking
+:Contact: ianb@colorstudy.com
+:date: $Date: 2003/11/01 20:35:45 $
+:version: $Revision: 1.3 $
+:copyright: This stylesheet has been placed in the public domain.
+
+A modification of the default cascading style sheet (v.1.3) for the
+HTML output of Docutils.  
+*/
+
+body {
+  font-family: Arial, sans-serif;
+}
+
+em, i {
+  /* Typically serif fonts have much nicer italics */
+  font-family: Times New Roman, Times, serif;
+}
+
+li {
+  list-style-type: circle;
+}
+
+a.target {
+  color: blue;
+}
+
+a.toc-backref {
+  text-decoration: none;
+  color: black;
+}
+
+a.toc-backref:hover {
+  background-color: inherit;
+}
+
+a:hover {
+  background-color: #cccccc;
+}
+
+cite {
+  font-style: normal;
+  font-family: monospace;
+  font-weight: bold;
+}
+
+dd {
+  margin-bottom: 0.5em;
+}
+
+div.abstract {
+  margin: 2em 5em;
+}
+
+div.abstract p.topic-title {
+  font-weight: bold;
+  text-align: center;
+}
+
+div.attention, div.caution, div.danger, div.error, div.hint,
+div.important, div.note, div.tip, div.warning {
+  background-color: #cccccc;
+  width: 40%;
+  border: medium outset;
+  padding: 3px;
+  float: right
+}
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+  color: #cc0000;
+  font-weight: bold;
+  font-family: sans-serif;
+  text-align: center;
+  background-color: #999999;
+  display: block;
+  margin: 0;
+}
+
+div.hint p.admonition-title, div.important p.admonition-title,
+div.note p.admonition-title, div.tip p.admonition-title {
+  font-weight: bold;
+  font-family: sans-serif;
+  text-align: center;
+  background-color: #999999;
+  display: block;
+  margin: 0;
+}
+
+div.dedication {
+  margin: 2em 5em;
+  text-align: center;
+  font-style: italic;
+}
+
+div.dedication p.topic-title {
+  font-weight: bold;
+  font-style: normal;
+}
+
+div.figure {
+  margin-left: 2em;
+}
+
+div.footer, div.header {
+  font-size: smaller;
+}
+
+div.system-messages {
+  margin: 5em;
+}
+
+div.system-messages h1 {
+  color: red;
+}
+
+div.system-message {
+  border: medium outset;
+  padding: 1em;
+}
+
+div.system-message p.system-message-title {
+  color: red;
+  font-weight: bold;
+}
+
+div.topic {
+  margin: 2em;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  font-family: Helvetica, Arial, sans-serif;
+  border: thin solid black;
+  /* This makes the borders rounded on Mozilla, which pleases me */
+  -moz-border-radius: 8px;
+  padding: 4px;
+}
+
+h1 {
+  background-color: #444499;
+  color: #ffffff;
+  border: medium solid black;
+}
+
+h1 a.toc-backref, h2 a.toc-backref { 
+  color: #ffffff;
+}
+
+h2 {
+  background-color: #666666;
+  color: #ffffff;
+  border: medium solid black;
+}
+
+h3, h4, h5, h6 {
+  background-color: #cccccc;
+  color: #000000;
+}
+
+h3 a.toc-backref, h4 a.toc-backref, h5 a.toc-backref, 
+h6 a.toc-backref { 
+  color: #000000;
+}
+
+h1.title {
+  text-align: center;
+  background-color: #444499;
+  color: #eeeeee;
+  border: thick solid black;
+  -moz-border-radius: 20px;
+}
+
+h2.subtitle {
+  text-align: center;
+}
+
+hr {
+  width: 75%;
+}
+
+ol.simple, ul.simple {
+  margin-bottom: 1em;
+}
+
+ol.arabic {
+  list-style: decimal;
+}
+
+ol.loweralpha {
+  list-style: lower-alpha;
+}
+
+ol.upperalpha {
+  list-style: upper-alpha;
+}
+
+ol.lowerroman {
+  list-style: lower-roman;
+}
+
+ol.upperroman {
+  list-style: upper-roman;
+}
+
+p.caption {
+  font-style: italic;
+}
+
+p.credits {
+  font-style: italic;
+  font-size: smaller;
+}
+
+p.first {
+  margin-top: 0;
+}
+
+p.label {
+  white-space: nowrap;
+}
+
+p.topic-title {
+  font-weight: bold;
+}
+
+pre.address {
+  margin-bottom: 0;
+  margin-top: 0;
+  font-family: serif;
+  font-size: 100%;
+}
+
+pre.line-block {
+  font-family: serif;
+  font-size: 100%;
+}
+
+pre.literal-block, pre.doctest-block {
+  margin-left: 2em;
+  margin-right: 2em;
+  background-color: #eeeeee;
+  border: thin black solid;
+  padding: 5px;
+}
+
+span.classifier {
+  font-family: sans-serif;
+  font-style: oblique;
+}
+
+span.classifier-delimiter {
+  font-family: sans-serif;
+  font-weight: bold;
+}
+
+span.interpreted {
+  font-family: sans-serif;
+}
+
+span.option-argument {
+  font-style: italic;
+}
+
+span.pre {
+  white-space: pre;
+}
+
+span.problematic {
+  color: red;
+}
+
+table {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+table.citation {
+  border-left: solid thin gray;
+  padding-left: 0.5ex
+}
+
+table.docinfo {
+  margin: 2em 4em;
+}
+
+table.footnote {
+  border-left: solid thin black;
+  padding-left: 0.5ex;
+}
+
+td, th {
+  padding-left: 0.5em;
+  padding-right: 0.5em;
+  vertical-align: top;
+}
+
+td > p:first-child, th > p:first-child {
+  margin-top: 0em;
+}
+
+th.docinfo-name, th.field-name {
+  font-weight: bold;
+  text-align: left;
+  white-space: nowrap;
+}
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+  font-size: 100%;
+}
+
+code, tt {
+  color: #000066;
+}
+
+ul.auto-toc {
+  list-style-type: none;
+}
+
+</style>
+</head>
+<body>
+<div class="document" id="py2app-convert-python-scripts-into-standalone-mac-os-x-applications">
+<h1 class="title">py2app - convert python scripts into standalone Mac OS X applications</h1>
+<div class="contents topic" id="contents">
+<p class="topic-title first"><a name="contents">Contents</a></p>
+<ul class="simple">
+<li><a class="reference" href="#abstract" id="id1" name="id1">Abstract</a></li>
+<li><a class="reference" href="#license" id="id2" name="id2">License</a></li>
+<li><a class="reference" href="#downloads" id="id3" name="id3">Downloads</a></li>
+<li><a class="reference" href="#py2app-documentation" id="id4" name="id4">py2app Documentation</a></li>
+<li><a class="reference" href="#bdist-mpkg-documentation" id="id5" name="id5">bdist_mpkg Documentation</a></li>
+<li><a class="reference" href="#tools" id="id6" name="id6">Tools</a></li>
+<li><a class="reference" href="#gui-tools" id="id7" name="id7">GUI Tools</a></li>
+</ul>
+</div>
+<div class="section" id="abstract">
+<h1><a class="toc-backref" href="#id1" name="abstract">Abstract</a></h1>
+<p><strong>py2app</strong> is a Python <a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> suite which provides several
+useful features for distributing Python applications and libraries
+on the Mac OS X platform.  The <strong>py2app</strong> suite contains the following
+packages:</p>
+<dl class="docutils">
+<dt><strong>py2app</strong>:</dt>
+<dd>A <a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> command that converts Python scripts into
+executable Mac OS X applications, able to run without requiring
+a Python installation.  It has been used to create standalone
+application bundles and plug-ins for open source, commercial,
+and in-house projects.  It is known compatible with GUI
+frameworks such as <a class="reference" href="http://www.wxpython.org/">wxPython</a>, <a class="reference" href="http://www.python.org/moin/TkInter">Tkinter</a>, <a class="reference" href="http://www.pygame.org/">pygame</a>, <a class="reference" href="http://www.riverbankcomputing.co.uk/pyqt/index.php">PyQt</a>, and
+<a class="reference" href="http://pyobjc.sourceforge.net/">PyObjC</a>, but it should work in the context of any framework with
+little or no effort.  It may also be used in conjunction with
+<a class="reference" href="http://pyobjc.sourceforge.net/">PyObjC</a> to write plug-ins for Cocoa applications, screen
+savers, preference panes, etc.  This is a complete replacement
+for the <a class="reference" href="http://www.python.org/moin/BundleBuilder">bundlebuilder</a> tool included in the Python standard library.</dd>
+<dt><strong>bdist_mpkg</strong>:</dt>
+<dd>Creates Mac OS X installer <tt class="docutils literal"><span class="pre">.mpkg</span></tt> files from Python libraries.
+Installer packages are familiar to Mac OS X users, provide a
+safe and easy way to authenticate as root to install privileged
+files such as headers and scripts.  Once a <strong>bdist_mpkg</strong>
+distribution has been created, it may be installed to other
+machines with a similar Python environment without requiring a
+compiler.  Installer packages can be used to do distributed
+installations with tools such as <a class="reference" href="http://www.apple.com/remotedesktop/">Apple Remote Desktop</a> or they
+could be integrated into a custom Mac OS X installation DVD
+with a tool such as <a class="reference" href="http://www.versiontracker.com/dyn/moreinfo/macosx/24178">Slipy</a>.</dd>
+<dt><strong>macholib</strong>:</dt>
+<dd>Reads and writes the Mach-O object file format.  Used by <strong>py2app</strong>
+to build a dependency graph of dyld and framework dependencies for your
+application, and then to copy them into your application and rewrite
+their load commands to be <tt class="docutils literal"><span class="pre">&#64;executable_path</span></tt> relative.  The end
+result is that your application is going to be completely standalone
+beyond a default install of Mac OS X.   You no longer have to worry
+about linking all of your dependencies statically, using
+<a class="reference" href="x-man-page://1/install_name_tool">install_name_tool</a>, etc.  It's all taken care of!</dd>
+<dt><strong>modulegraph</strong>:</dt>
+<dd>A replacement for the Python standard library <a class="reference" href="http://pydoc.org/2.3/modulefinder.html">modulefinder</a>.  Stores
+the module dependency tree in a graph data structure and allows for
+advanced filtering and analysis capabilities, such as <a class="reference" href="http://www.research.att.com/sw/tools/graphviz/">GraphViz</a> dot
+output.  This is used internally by <strong>py2app</strong>, but the code should
+be completely cross-platform.  It is hoped that this package will be
+adopted by application packaging software for other platforms in the
+future, such as <a class="reference" href="http://starship.python.net/crew/theller/py2exe/">py2exe</a> and <a class="reference" href="http://starship.python.net/crew/atuining/cx_Freeze/">cx_Freeze</a>.</dd>
+<dt><strong>altgraph</strong>:</dt>
+<dd>This is a fork of <a class="reference" href="http://www.personal.psu.edu/staff/i/u/iua1/">Istvan Albert</a>'s <a class="reference" href="http://www.personal.psu.edu/staff/i/u/iua1/python/graphlib/html/public/graphlib-module.html">graphlib</a>, and it used internally
+by both <strong>macholib</strong> and <strong>modulegraph</strong>.  It contains several small
+feature and performance enhancements over the original <a class="reference" href="http://www.personal.psu.edu/staff/i/u/iua1/python/graphlib/html/public/graphlib-module.html">graphlib</a>.</dd>
+</dl>
+</div>
+<div class="section" id="license">
+<h1><a class="toc-backref" href="#id2" name="license">License</a></h1>
+<p>Any components of the <strong>py2app</strong> suite may be distributed under the MIT
+or PSF open source licenses.</p>
+</div>
+<div class="section" id="downloads">
+<h1><a class="toc-backref" href="#id3" name="downloads">Downloads</a></h1>
+<p>Note that the installer for <a class="reference" href="http://pyobjc.sourceforge.net/">PyObjC</a> 1.2 ships with <strong>py2app</strong> 0.1.7.</p>
+<p>An installer for <strong>py2app</strong> 0.1.8 may be downloaded from:</p>
+<ul class="simple">
+<li><a class="reference" href="http://undefined.org/python/packages.html">http://undefined.org/python/packages.html</a></li>
+</ul>
+<p>The source to <strong>py2app</strong> 0.1.8 may be downloaded here:</p>
+<ul class="simple">
+<li><a class="reference" href="http://undefined.org/python/py2app-0.1.8.tgz">http://undefined.org/python/py2app-0.1.8.tgz</a></li>
+</ul>
+<p><strong>py2app</strong> maintains a public subversion source code repository currently
+located at:</p>
+<ul class="simple">
+<li><a class="reference" href="http://svn.red-bean.com/bob/py2app/trunk/">http://svn.red-bean.com/bob/py2app/trunk/</a></li>
+</ul>
+<p>As of version 0.1.6, <strong>py2app</strong> uses the <tt class="docutils literal"><span class="pre">extra_path</span></tt> feature of 
+<a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a>, which changes the installation layout.  
+If you have <strong>py2app</strong> 0.1.5 or earlier installed, you must manually
+remove the following directories from your site-packages directory
+(probably <tt class="docutils literal"><span class="pre">/Library/Python/2.3</span></tt>) if they exist before upgrading:</p>
+<ul class="simple">
+<li><tt class="docutils literal"><span class="pre">py2app</span></tt></li>
+<li><tt class="docutils literal"><span class="pre">macholib</span></tt></li>
+<li><tt class="docutils literal"><span class="pre">bdist_mpkg</span></tt></li>
+<li><tt class="docutils literal"><span class="pre">modulegraph</span></tt></li>
+<li><tt class="docutils literal"><span class="pre">altgraph</span></tt></li>
+</ul>
+</div>
+<div class="section" id="py2app-documentation">
+<h1><a class="toc-backref" href="#id4" name="py2app-documentation">py2app Documentation</a></h1>
+<ul>
+<li><p class="first">How do I use <strong>py2app</strong>?</p>
+<p><strong>py2app</strong> is a <a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> command that is used in a similar manner to
+<strong>py2exe</strong>.  For your application, you must create a Python script
+(conventionally named <tt class="docutils literal"><span class="pre">setup.py</span></tt>) that looks like the following:</p>
+<pre class="literal-block">
+#!/usr/bin/env python
+&quot;&quot;&quot;
+setup.py - script for building MyApplication
+
+Usage:
+    % python setup.py py2app
+&quot;&quot;&quot;
+from distutils.core import setup
+import py2app
+
+setup(
+    app=['MyApplication.py'],
+)
+</pre>
+<p>When running this script as directed, <strong>py2app</strong> will do the following:</p>
+<ul>
+<li><p class="first">Process the command line for arguments.  The arguments accepted by the <strong>py2app</strong>
+command can be enumerated using the following command line:</p>
+<pre class="literal-block">
+% python setup.py py2app --help
+Global options:
+  ... (these are available from any distutils command)
+Options for 'py2app' command:
+  ... (these are specific to py2app)
+usage: 
+  ... (this is a generic distutils usage message)
+</pre>
+<p>Note that any of the options accepted on the command line may also be used
+in your <tt class="docutils literal"><span class="pre">setup.py</span></tt> script!  For example:</p>
+<pre class="literal-block">
+#!/usr/bin/env python
+&quot;&quot;&quot;
+setup.py - script for building MyApplication
+&quot;&quot;&quot;
+from distutils.core import setup
+import py2app
+
+# Note that you must replace hypens '-' with underscores '_'
+# when converting option names from the command line to a script.
+# For example, the --argv-emulation option is passed as 
+# argv_emulation in an options dict.
+py2app_options = dict(
+    # Map &quot;open document&quot; events to sys.argv.
+    # Scripts that expect files as command line arguments
+    # can be trivially used as &quot;droplets&quot; using this option.
+    # Without this option, sys.argv should not be used at all
+    # as it will contain only Mac OS X specific stuff.
+    argv_emulation=True,
+
+    # This is a shortcut that will place MyApplication.icns
+    # in the Contents/Resources folder of the application bundle,
+    # and make sure the CFBundleIcon plist key is set appropriately.
+    iconfile='MyApplication.icns',
+)
+
+setup(
+    app=['MyApplication.py'],
+    options=dict(
+        # Each command is allowed to have its own
+        # options, so we must specify that these
+        # options are py2app specific.
+        py2app=py2app_options,
+    )
+)
+</pre>
+</li>
+<li><p class="first">Issue the <a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> <tt class="docutils literal"><span class="pre">build</span></tt> command</p>
+<ul class="simple">
+<li>If your application needs any Extensions, then these will be
+built at this time, and the build directory will be added to <tt class="docutils literal"><span class="pre">sys.path</span></tt>.</li>
+</ul>
+</li>
+<li><p class="first">Analyze the application for Python dependencies</p>
+<ul class="simple">
+<li>Compile <tt class="docutils literal"><span class="pre">MyApplication.py</span></tt> to Python bytecode and analyze it for 
+<a class="reference" href="http://docs.python.org/ref/import.html">import</a> statements.</li>
+<li>Build a dependency graph of everything it finds (with <strong>modulegraph</strong>).</li>
+<li>It will look for modules and packages in the same manner as Python would
+if you ran <tt class="docutils literal"><span class="pre">python</span> <span class="pre">MyApplication.py</span></tt>.  Namely, it will look first in the
+same directory as <tt class="docutils literal"><span class="pre">MyApplication.py</span></tt>, and then it will search <tt class="docutils literal"><span class="pre">sys.path</span></tt>.
+If for some reason you need it to look somewhere else, simply modify your
+<tt class="docutils literal"><span class="pre">setup.py</span></tt> script such that it modifies <tt class="docutils literal"><span class="pre">sys.path</span></tt> before calling the
+<a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> <tt class="docutils literal"><span class="pre">setup(...)</span></tt> function.</li>
+</ul>
+</li>
+<li><p class="first">Make sense of the dependencies</p>
+<ul class="simple">
+<li>Using special library-specific tweaks called recipes, it will modify
+this dependency graph as needed.  For example, it will perform such tasks
+as eliminating unwanted dependencies (<a class="reference" href="http://docs.python.org/lib/module-pydoc.html">pydoc</a>'s import of <a class="reference" href="http://www.python.org/moin/TkInter">Tkinter</a>) and
+including &quot;plugins&quot; for certain libraries that do not use the normal import
+statements (<a class="reference" href="http://www.pythonware.com/products/pil/">PIL</a>, <a class="reference" href="http://docutils.sourceforge.net/">docutils</a>).  See the section below on recipes for
+more information about this process.</li>
+</ul>
+</li>
+<li><p class="first">Create the application bundle</p>
+<ul class="simple">
+<li>An application bundle will be created in the dist directory with the name
+of your application.</li>
+<li>Based upon information in <strong>py2app</strong> and information you passed to
+<tt class="docutils literal"><span class="pre">setup(...)</span></tt>, an <tt class="docutils literal"><span class="pre">Info.plist</span></tt> will be created in the application bundle
+with metadata appropriate to your application.</li>
+<li>A <tt class="docutils literal"><span class="pre">__boot__.py</span></tt> script will be created in the <tt class="docutils literal"><span class="pre">Contents/Resources</span></tt> folder
+of the application bundle containing <strong>py2app</strong> specific bootstrapping code
+to get your application running.</li>
+<li>The main script of your application will be copied as-is to the
+<tt class="docutils literal"><span class="pre">Contents/Resources/Python</span></tt> folder.  This may change in the future,
+but it is currently in source form and is not obfuscated in any way
+other than its location.</li>
+<li>Packages that were explicitly included with the <tt class="docutils literal"><span class="pre">--packages</span></tt> option are
+placed in <tt class="docutils literal"><span class="pre">Contents/Resources/Python/site-packages</span></tt>.</li>
+<li>A zip file containing all other dependencies is created at
+<tt class="docutils literal"><span class="pre">Contents/Resources/Python/site-packages.zip</span></tt>.</li>
+<li>Extensions that could not be included in the zip file are copied to
+appropriate locations in <tt class="docutils literal"><span class="pre">Contents/Resources/Python/lib-dynload</span></tt>.</li>
+</ul>
+</li>
+<li><p class="first">Make the application bundle standalone</p>
+<ul class="simple">
+<li>Since a typical Python application may have C library dependencies, such as
+the Python interpreter itself, wxWidgets, etc. a second dependency resolution
+pass occurs on the application bundle.</li>
+<li>Scan the application bundle for all Mach-O files (executables, shared libraries,
+plugins, extensions, etc.).</li>
+<li>Read the load commands from every Mach-O file (using <strong>macholib</strong>) and build
+a dependency graph.</li>
+<li>Copy in every dependent dylib (shared library) and framework that is not already
+in the application bundle.  Note that dylibs and frameworks in vendor locations
+(<tt class="docutils literal"><span class="pre">/System</span></tt> and <tt class="docutils literal"><span class="pre">/usr</span></tt> - except for <tt class="docutils literal"><span class="pre">/usr/local</span></tt>) are NOT included in your
+application bundle.  This can include the Python interpreter, if you are using
+a Python interpreter shipped with Mac OS X.  Thus your application may be
+&quot;tightly bound&quot; to a particular major version of Mac OS X if you are using
+the vendor Python.</li>
+<li>Rewrite the Mach-O load commands such that the libraries know that
+they have moved inside of an application bundle (i.e. using
+<tt class="docutils literal"><span class="pre">&#64;executable_path</span></tt> relative ids).</li>
+<li>Strip every Mach-O file of extraneous information (debugging symbols, etc.) 
+to save space.  This may be disabled with <tt class="docutils literal"><span class="pre">--no-strip</span></tt>.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li><p class="first">What recipes does <strong>py2app</strong> come with?</p>
+<dl class="docutils">
+<dt><a class="reference" href="http://docutils.sourceforge.net/">docutils</a>:</dt>
+<dd><p class="first last">Locates and includes all plugins that ship with docutils (languages,
+parsers, readers, writers)</p>
+</dd>
+<dt><a class="reference" href="http://docs.python.org/lib/module-pydoc.html">pydoc</a>:</dt>
+<dd><p class="first last">Removes several dependencies that are only used when running the <a class="reference" href="http://docs.python.org/lib/module-pydoc.html">pydoc</a>
+web server or <a class="reference" href="http://www.python.org/moin/TkInter">Tkinter</a> GUI (Tkinter, tty, BaseHTTPServer, mimetools, select,
+threading, ic, getopt).</p>
+</dd>
+<dt><a class="reference" href="http://www.pygame.org/">pygame</a>:</dt>
+<dd><p class="first last">Includes the whole <a class="reference" href="http://www.pygame.org/">pygame</a> package as-is, so that it will locate its data
+files correctly.  This recipe may be improved in the future if <a class="reference" href="http://www.pygame.org/">pygame</a>
+undergoes appropriate modifications.</p>
+</dd>
+<dt><a class="reference" href="http://www.pythonware.com/products/pil/">PIL</a>:</dt>
+<dd><p class="first last">Locates and includes all image plugins (Python modules that end with
+<tt class="docutils literal"><span class="pre">ImagePlugin.py</span></tt>), removes unwanted dependencies on <a class="reference" href="http://www.python.org/moin/TkInter">Tkinter</a>.</p>
+</dd>
+<dt><a class="reference" href="http://pyopengl.sourceforge.net/">pyOpenGL</a>:</dt>
+<dd><p class="first last">Includes the whole <a class="reference" href="http://pyopengl.sourceforge.net/">pyOpenGL</a> package as-is, so that it can read its version
+file during __init__.py.  This recipe may be improved in the future if
+<a class="reference" href="http://pyopengl.sourceforge.net/">PyOpenGL</a> undergoes appropriate modifications.</p>
+</dd>
+<dt><strong>py2app</strong>:</dt>
+<dd><p class="first last">Includes the whole <strong>py2app</strong> package as-is, so that it has copies of the
+executable and plugin templates.  This recipe may be improved in the future
+if <strong>py2app</strong> undergoes appropriate modifications.</p>
+</dd>
+<dt><a class="reference" href="http://www.riverbankcomputing.co.uk/sip/index.php">sip</a>:</dt>
+<dd><p class="first last">If ANY extension that uses <a class="reference" href="http://www.riverbankcomputing.co.uk/sip/index.php">sip</a> is detected, include all extensions that use
+<a class="reference" href="http://www.riverbankcomputing.co.uk/sip/index.php">sip</a>.  This is necessary because <a class="reference" href="http://www.riverbankcomputing.co.uk/sip/index.php">sip</a> generates C code to do its imports,
+and is thus not trackable by bytecode analysis.  The only package known to use
+<a class="reference" href="http://www.riverbankcomputing.co.uk/sip/index.php">sip</a> is <a class="reference" href="http://www.riverbankcomputing.co.uk/pyqt/index.php">PyQt</a>, so what this means is that if you use any of <a class="reference" href="http://www.riverbankcomputing.co.uk/pyqt/index.php">PyQt</a>, then
+all of it will be included.</p>
+</dd>
+</dl>
+<p>Note that recipes are developed on an
+as-needed basis, and coverage of every single Python library is not possible.
+If you have trouble with a particular library, please let us know.</p>
+<p>The following packages are known to need recipes, but none currently exist:</p>
+<dl class="docutils">
+<dt><a class="reference" href="http://peak.telecommunity.com/">PEAK</a>:</dt>
+<dd><p class="first last">The workaround is to include <a class="reference" href="http://peak.telecommunity.com/">PEAK</a> using the <tt class="docutils literal"><span class="pre">packages</span></tt> option.</p>
+</dd>
+<dt>Anything that uses <a class="reference" href="http://www.pango.org/">Pango</a> or <a class="reference" href="http://www.gtk.org/">GTK+</a>:</dt>
+<dd><p class="first last">These C libraries require data files and environment variables set up.
+A workaround exists, but one has not yet been written and tested.</p>
+</dd>
+<dt><a class="reference" href="http://www.wxpython.org/">wxPython</a> 2.4.x:</dt>
+<dd><p class="first">A <tt class="docutils literal"><span class="pre">data_files</span></tt> option to include a resource file must be added to
+<tt class="docutils literal"><span class="pre">setup.py</span></tt>:</p>
+<pre class="last literal-block">
+#!/usr/bin/env python
+&quot;&quot;&quot;
+setup.py - workaround for wxPython 2.4.x
+
+Usage:
+    % python setup.py py2app
+&quot;&quot;&quot;
+from distutils.core import setup
+import py2app
+setup(
+    app=['test.py'],
+    data_files=[('../Frameworks', [
+        '/usr/local/lib/libwx_mac-2.4.0.rsrc',
+        ]
+    )],
+)
+</pre>
+</dd>
+</dl>
+</li>
+</ul>
+<p>XXX</p>
+<ul class="simple">
+<li>What's the recommended <strong>py2app</strong> development model?</li>
+<li>What does <strong>py2app</strong> install?</li>
+<li>How does <strong>py2app</strong> differ from <a class="reference" href="http://starship.python.net/crew/theller/py2exe/">py2exe</a> or <a class="reference" href="http://starship.python.net/crew/atuining/cx_Freeze/">cx_Freeze</a>?</li>
+<li>When should I subclass the <strong>py2app</strong> command?</li>
+<li>Known issues with <strong>py2app</strong></li>
+</ul>
+</div>
+<div class="section" id="bdist-mpkg-documentation">
+<h1><a class="toc-backref" href="#id5" name="bdist-mpkg-documentation">bdist_mpkg Documentation</a></h1>
+<p>XXX</p>
+<ul class="simple">
+<li>What exactly does <strong>bdist_mpkg</strong> do?</li>
+<li>What options does <strong>bdist_mpkg</strong> accept?</li>
+<li>When should I subclass the <strong>bdist_mpkg</strong> command?</li>
+</ul>
+</div>
+<div class="section" id="tools">
+<h1><a class="toc-backref" href="#id6" name="tools">Tools</a></h1>
+<p>By default, the following tools are installed to <tt class="docutils literal"><span class="pre">/usr/local/bin</span></tt>:</p>
+<dl class="docutils">
+<dt><strong>bdist_mpkg</strong>:</dt>
+<dd><p class="first">A convenient way to run the <strong>bdist_mpkg</strong> <a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> command.
+Equivalent to editing the <tt class="docutils literal"><span class="pre">setup.py</span></tt> in the current
+directory to import <strong>bdist_mpkg</strong> and running the following
+command:</p>
+<pre class="literal-block">
+python setup.py bdist_mpkg --open
+</pre>
+<p class="last">If any options are given, then they are given in place of <tt class="docutils literal"><span class="pre">--open</span></tt>.</p>
+</dd>
+<dt><strong>macho_find</strong>:</dt>
+<dd>A tool for finding Mach-O object files using <strong>macholib</strong>.
+The arguments may be files or directories.  The output of this tool is
+identical to that of the BSD <a class="reference" href="x-man-page://1/find">find</a> command.</dd>
+<dt><strong>macho_standalone</strong>:</dt>
+<dd>A tool that makes a valiant attempt to make the given application
+bundle standalone using <strong>macholib</strong> using machinery similar, but not
+identical to, what happens when using <strong>py2app</strong>.  This tool modifies
+the given application bundle in-place, so you may want to make a backup
+before performing this operation.  This tool works for ANY Mach-O
+executable bundle, and contains no Python-specific functionality.</dd>
+<dt><strong>py2applet</strong>:</dt>
+<dd>A convenient way to run the <strong>py2app</strong> <a class="reference" href="http://docs.python.org/lib/module-distutils.html">distutils</a> command without
+creating a <tt class="docutils literal"><span class="pre">setup.py</span></tt>.  The first python script passed as an
+argument will be the main script, any additional files or directories
+will be considered as data files.  If a file with the <tt class="docutils literal"><span class="pre">.icns</span></tt>
+extension is passed, it will be used as the application's icon.  If
+a file named <tt class="docutils literal"><span class="pre">Info.plist</span></tt> is given, it will be used as the template
+for the application's <tt class="docutils literal"><span class="pre">Info.plist</span></tt>.  The application will be built
+with the <tt class="docutils literal"><span class="pre">--argv-emulation</span></tt> on.  It is not possible to pass options
+to py2applet.  If you need anything more, you should create a
+<tt class="docutils literal"><span class="pre">setup.py</span></tt> and use the <strong>py2app</strong> command in the normal fashion.</dd>
+</dl>
+</div>
+<div class="section" id="gui-tools">
+<h1><a class="toc-backref" href="#id7" name="gui-tools">GUI Tools</a></h1>
+<p>By default, the following GUI tools are installed to
+<tt class="docutils literal"><span class="pre">/Developer/Applications/Python</span> <span class="pre">Tools/py2app</span></tt>:</p>
+<dl class="docutils">
+<dt><strong>PackageInstaller</strong>:</dt>
+<dd>A droplet version of the <strong>bdist_mpkg</strong> tool, it does
+not have any interactivity, so it is not possible to use this tool
+to pass options other than the default.  Errors and informational
+messages will go to the Console.</dd>
+<dt><strong>py2applet</strong>:</dt>
+<dd>A droplet version of the <strong>py2applet</strong> tool.  It works in
+exactly the same way and provides no interactivity.  Note that
+since you have no guarantee of the order of files in the pasteboard,
+you should drag only one at a time to this script.  Errors and
+informational messages will go to the console.</dd>
+</dl>
+<hr class="docutils" />
+<p>Copyright (c) 2004, 2005 Bob Ippolito &lt;bob at redivi.com&gt;.</p>
+</div>
+</div>
+</body>
+</html>
+py2app - convert python scripts into standalone Mac OS X applications
+=====================================================================
+
+.. contents::
+
+Abstract
+--------
+
+**py2app** is a Python `distutils`_ suite which provides several
+useful features for distributing Python applications and libraries
+on the Mac OS X platform.  The **py2app** suite contains the following
+packages:
+
+**py2app**:
+
+    A `distutils`_ command that converts Python scripts into
+    executable Mac OS X applications, able to run without requiring
+    a Python installation.  It has been used to create standalone
+    application bundles and plug-ins for open source, commercial,
+    and in-house projects.  It is known compatible with GUI
+    frameworks such as `wxPython`_, `Tkinter`_, `pygame`_, `PyQt`_, and
+    `PyObjC`_, but it should work in the context of any framework with
+    little or no effort.  It may also be used in conjunction with
+    `PyObjC`_ to write plug-ins for Cocoa applications, screen
+    savers, preference panes, etc.  This is a complete replacement
+    for the `bundlebuilder`_ tool included in the Python standard library.
+
+**bdist_mpkg**:
+
+    Creates Mac OS X installer ``.mpkg`` files from Python libraries.
+    Installer packages are familiar to Mac OS X users, provide a
+    safe and easy way to authenticate as root to install privileged
+    files such as headers and scripts.  Once a **bdist_mpkg**
+    distribution has been created, it may be installed to other
+    machines with a similar Python environment without requiring a
+    compiler.  Installer packages can be used to do distributed
+    installations with tools such as `Apple Remote Desktop`_ or they
+    could be integrated into a custom Mac OS X installation DVD
+    with a tool such as `Slipy`_.
+
+**macholib**:
+
+    Reads and writes the Mach-O object file format.  Used by **py2app**
+    to build a dependency graph of dyld and framework dependencies for your
+    application, and then to copy them into your application and rewrite
+    their load commands to be ``@executable_path`` relative.  The end
+    result is that your application is going to be completely standalone
+    beyond a default install of Mac OS X.   You no longer have to worry
+    about linking all of your dependencies statically, using
+    `install_name_tool`_, etc.  It's all taken care of!
+
+**modulegraph**:
+
+    A replacement for the Python standard library `modulefinder`_.  Stores
+    the module dependency tree in a graph data structure and allows for
+    advanced filtering and analysis capabilities, such as `GraphViz`_ dot
+    output.  This is used internally by **py2app**, but the code should
+    be completely cross-platform.  It is hoped that this package will be
+    adopted by application packaging software for other platforms in the
+    future, such as `py2exe`_ and `cx_Freeze`_.
+
+**altgraph**:
+
+    This is a fork of `Istvan Albert`_'s `graphlib`_, and it used internally
+    by both **macholib** and **modulegraph**.  It contains several small
+    feature and performance enhancements over the original `graphlib`_.
+    
+License
+-------
+
+Any components of the **py2app** suite may be distributed under the MIT
+or PSF open source licenses.
+
+Downloads
+---------
+
+Note that the installer for `PyObjC`_ 1.2 ships with **py2app** 0.1.7. 
+
+An installer for **py2app** 0.1.8 may be downloaded from:
+
+- http://undefined.org/python/packages.html
+
+The source to **py2app** 0.1.8 may be downloaded here:
+
+- http://undefined.org/python/py2app-0.1.8.tgz
+
+**py2app** maintains a public subversion source code repository currently
+located at:
+
+- http://svn.red-bean.com/bob/py2app/trunk/
+
+
+As of version 0.1.6, **py2app** uses the ``extra_path`` feature of 
+`distutils`_, which changes the installation layout.  
+If you have **py2app** 0.1.5 or earlier installed, you must manually
+remove the following directories from your site-packages directory
+(probably ``/Library/Python/2.3``) if they exist before upgrading:
+
+- ``py2app``
+- ``macholib``
+- ``bdist_mpkg``
+- ``modulegraph``
+- ``altgraph``
+
+py2app Documentation
+--------------------
+
+- How do I use **py2app**?
+
+  **py2app** is a `distutils`_ command that is used in a similar manner to
+  **py2exe**.  For your application, you must create a Python script
+  (conventionally named ``setup.py``) that looks like the following::
+
+    #!/usr/bin/env python
+    """
+    setup.py - script for building MyApplication
+
+    Usage:
+        % python setup.py py2app
+    """
+    from setuptools import setup
+
+    setup(
+        app=['MyApplication.py'],
+    )
+
+  When running this script as directed, **py2app** will do the following:
+
+  - Process the command line for arguments.  The arguments accepted by the 
+    **py2app** command can be enumerated using the following command line::
+
+      % python setup.py py2app --help
+      Global options:
+        ... (these are available from any distutils command)
+      Options for 'py2app' command:
+        ... (these are specific to py2app)
+      usage: 
+        ... (this is a generic distutils usage message)
+
+    Note that any of the options accepted on the command line may also be used
+    in your ``setup.py`` script!  For example::
+
+      #!/usr/bin/env python
+      """
+      setup.py - script for building MyApplication
+      """
+      from setuptools import setup
+
+      # Note that you must replace hypens '-' with underscores '_'
+      # when converting option names from the command line to a script.
+      # For example, the --argv-emulation option is passed as 
+      # argv_emulation in an options dict.
+      py2app_options = dict(
+          # Map "open document" events to sys.argv.
+          # Scripts that expect files as command line arguments
+          # can be trivially used as "droplets" using this option.
+          # Without this option, sys.argv should not be used at all
+          # as it will contain only Mac OS X specific stuff.
+          argv_emulation=True,
+
+          # This is a shortcut that will place MyApplication.icns
+          # in the Contents/Resources folder of the application bundle,
+          # and make sure the CFBundleIcon plist key is set appropriately.
+          iconfile='MyApplication.icns',
+      )
+
+      setup(
+          app=['MyApplication.py'],
+          options=dict(
+              # Each command is allowed to have its own
+              # options, so we must specify that these
+              # options are py2app specific.
+              py2app=py2app_options,
+          )
+      )
+
+  - Issue the `distutils`_ ``build`` command
+
+    - If your application needs any Extensions, then these will be
+      built at this time, and the build directory will be added to ``sys.path``.
+
+  - Analyze the application for Python dependencies
+    
+    - Compile ``MyApplication.py`` to Python bytecode and analyze it for 
+      `import`_ statements.
+    - Build a dependency graph of everything it finds (with **modulegraph**).
+    - It will look for modules and packages in the same manner as Python would
+      if you ran ``python MyApplication.py``.  Namely, it will look first in the
+      same directory as ``MyApplication.py``, and then it will search ``sys.path``.
+      If for some reason you need it to look somewhere else, simply modify your
+      ``setup.py`` script such that it modifies ``sys.path`` before calling the
+      `distutils`_ ``setup(...)`` function.
+
+  - Make sense of the dependencies
+
+    - Using special library-specific tweaks called recipes, it will modify
+      this dependency graph as needed.  For example, it will perform such tasks
+      as eliminating unwanted dependencies (`pydoc`_'s import of `Tkinter`_) and
+      including "plugins" for certain libraries that do not use the normal import
+      statements (`PIL`_, `docutils`_).  See the section below on recipes for
+      more information about this process.
+
+  - Create the application bundle
+
+    - An application bundle will be created in the dist directory with the name
+      of your application.
+    - Based upon information in **py2app** and information you passed to
+      ``setup(...)``, an ``Info.plist`` will be created in the application bundle
+      with metadata appropriate to your application.
+    - A ``__boot__.py`` script will be created in the ``Contents/Resources`` folder
+      of the application bundle containing **py2app** specific bootstrapping code
+      to get your application running.
+    - The main script of your application will be copied as-is to the
+      ``Contents/Resources/Python`` folder.  This may change in the future,
+      but it is currently in source form and is not obfuscated in any way
+      other than its location.
+    - Packages that were explicitly included with the ``--packages`` option are
+      placed in ``Contents/Resources/Python/site-packages``.
+    - A zip file containing all other dependencies is created at
+      ``Contents/Resources/Python/site-packages.zip``.
+    - Extensions that could not be included in the zip file are copied to
+      appropriate locations in ``Contents/Resources/Python/lib-dynload``.
+
+  - Make the application bundle standalone
+
+    - Since a typical Python application may have C library dependencies, such as
+      the Python interpreter itself, wxWidgets, etc. a second dependency resolution
+      pass occurs on the application bundle.
+    - Scan the application bundle for all Mach-O files (executables, shared libraries,
+      plugins, extensions, etc.).
+    - Read the load commands from every Mach-O file (using **macholib**) and build
+      a dependency graph.
+    - Copy in every dependent dylib (shared library) and framework that is not already
+      in the application bundle.  Note that dylibs and frameworks in vendor locations
+      (``/System`` and ``/usr`` - except for ``/usr/local``) are NOT included in your
+      application bundle.  This can include the Python interpreter, if you are using
+      a Python interpreter shipped with Mac OS X.  Thus your application may be
+      "tightly bound" to a particular major version of Mac OS X if you are using
+      the vendor Python.
+    - Rewrite the Mach-O load commands such that the libraries know that
+      they have moved inside of an application bundle (i.e. using
+      ``@executable_path`` relative ids).
+    - Strip every Mach-O file of extraneous information (debugging symbols, etc.) 
+      to save space.  This may be disabled with ``--no-strip``.
+
+
+- What recipes does **py2app** come with?
+
+  `docutils`_:
+
+    Locates and includes all plugins that ship with docutils (languages,
+    parsers, readers, writers)
+
+  `pydoc`_:
+
+    Removes several dependencies that are only used when running the `pydoc`_
+    web server or `Tkinter`_ GUI (Tkinter, tty, BaseHTTPServer, mimetools, select,
+    threading, ic, getopt).
+
+  `pygame`_:
+
+    Includes the whole `pygame`_ package as-is, so that it will locate its data
+    files correctly.  This recipe may be improved in the future if `pygame`_
+    undergoes appropriate modifications.
+
+  `PIL`_:
+
+    Locates and includes all image plugins (Python modules that end with
+    ``ImagePlugin.py``), removes unwanted dependencies on `Tkinter`_.
+
+  `pyOpenGL`_:
+
+    Includes the whole `pyOpenGL`_ package as-is, so that it can read its version
+    file during __init__.py.  This recipe may be improved in the future if
+    `PyOpenGL`_ undergoes appropriate modifications.
+
+  **py2app**:
+
+    Includes the whole **py2app** package as-is, so that it has copies of the
+    executable and plugin templates.  This recipe may be improved in the future
+    if **py2app** undergoes appropriate modifications.
+
+  `sip`_:
+
+    If ANY extension that uses `sip`_ is detected, include all extensions that use
+    `sip`_.  This is necessary because `sip`_ generates C code to do its imports,
+    and is thus not trackable by bytecode analysis.  The only package known to use
+    `sip`_ is `PyQt`_, so what this means is that if you use any of `PyQt`_, then
+    all of it will be included.
+
+  Note that recipes are developed on an
+  as-needed basis, and coverage of every single Python library is not possible.
+  If you have trouble with a particular library, please let us know.
+
+  The following packages are known to need recipes, but none currently exist:
+
+  `PEAK`_:
+
+    The workaround is to include `PEAK`_ using the ``packages`` option.
+ 
+  Anything that uses `Pango`_ or `GTK+`_:
+
+    These C libraries require data files and environment variables set up.
+    A workaround exists, but one has not yet been written and tested.
+
+  `wxPython`_ 2.4.x:
+
+    A ``data_files`` option to include a resource file must be added to
+    ``setup.py``::
+
+        #!/usr/bin/env python
+        """
+        setup.py - workaround for wxPython 2.4.x
+
+        Usage:
+            % python setup.py py2app
+        """
+        from setuptools import setup
+        setup(
+            app=['test.py'],
+            data_files=[('../Frameworks', [
+                '/usr/local/lib/libwx_mac-2.4.0.rsrc',
+                ]
+            )],
+        )
+   
+
+- The **py2app** development model
+
+  Currently, the best description for the preferred development model when
+  doing **py2app** based development lives in the `PyObjC tutorial`_.
+
+- What is an alias bundle (the ``--alias`` option)?
+
+  An alias bundle is intended to be used only during development.  Alias bundles
+  Are *not* portable to other machines and are not standalone in any way.
+  Alias bundles have the following features:
+
+  - Creating them is extremely fast, as no dependency resolution, copying, etc. happens.
+  - They use an alias to your main script, and symlinks to your data files. So, unless you need to change the ``setup.py``, you do not need to rebuild the alias bundle.
+  - This means that you can simply edit the source, and restart the application!
+
+  An alias bundle is similar to `BundleBuilder`_'s ``--link`` option, and is
+  roughly equivalent to the idea of `Xcode`_'s `ZeroLink`_ feature.
+
+- What does **py2app** install?
+
+  ``/Library/Python/2.3`` (or your ``site-packages`` directory):
+
+    A **py2app** folder containing the **py2app**, **macholib**,
+    **altgraph**, and **bdist_mpkg** packages.  A **py2app.pth** file
+    is also created, so that this **py2app** folder is automatically
+    added to your ``sys.path``.  This corresponds to the ``src`` folder
+    in the **py2app** sources.
+
+  ``/usr/local/bin``:
+
+    Several command line tools that make the **py2app** suite easier to use,
+    see the `Tools`_ section.  This corresponds to the ``scripts`` folder
+    in the **py2app** sources.
+
+  ``/Developer/Python/py2app/Examples``:
+
+    Several examples of **py2app** ``setup.py`` scripts of varying complexity.
+    This corresponds to the ``examples`` folder in the **py2app** sources.
+
+  ``/Developer/Applications/Python Tools/py2app``:
+
+    Several GUI tools and droplets that make the **py2app** suite easier to
+    use, see the `GUI Tools`_ section.  This corresponds to the ``tools``
+    folder in the **py2app** sources.
+
+- How does **py2app** differ from `py2exe`_ or `cx_Freeze`_?
+
+  - **py2app** has a richer system for managing Python module dependencies,
+    **modulegraph**, where `py2exe`_ and `cx_Freeze`_ use some cruft on top
+    of the standard library `modulefinder`_.
+  
+  - **py2app** works on Mac OS X, the others don't (and vice versa for their
+    respective operating systems).
+
+  - (XXX: describe syntax differences here)
+
+- What are the similarities between **py2app**, `py2exe`_, and `cx_Freeze`_?
+  
+  XXX
+
+- What is the canonical way for my application to detect if it is being
+  run in a bundled application environment?
+
+  Currently this information is in the `pythonmac.org FAQ`_.
+
+- When should I subclass the **py2app** command?
+
+  There are no known cases where this has been necessary, so you probably
+  don't!
+
+- Known issues with **py2app**
+
+  Current issues with **py2app** are reflected in the `TODO`_ document
+  in the source tree.  The linked document reflects the current development
+  version.  Also see the errata in the section about recipes above.
+
+bdist_mpkg Documentation
+------------------------
+
+- How do I use **bdist_mpkg**?
+
+  **bdist_mpkg** is intended to package existing Python software that
+  already has a `distutils`_ ``setup.py`` script.
+
+  The easiest way to use the features of **bdist_mpkg** is simply to
+  use the **bdist_mpkg** tool, as documented in the `Tools`_ section below.
+
+  Otherwise, in order to enable the **bdist_mpkg** command in a 
+  given ``setup.py`` script, simply add an ``import bdist_mpkg`` statement 
+  near the top of the ``setup.py`` script.
+
+- What options does **bdist_mpkg** accept?
+
+  To see the list of options that **bdist_mpkg** accepts, simply run it with
+  the ``--help`` option (this must be done in a directory containing a
+  `distutils`_ ``setup.py`` script)::
+
+    % bdist_mpkg --help
+    Global options:
+      ... (these are available from any distutils command)
+    Options for 'bdist_mpkg' command:
+      ... (these are specific to bdist_mpkg)
+    usage: 
+      ... (this is a generic distutils usage message)
+
+- When should I subclass the **bdist_mpkg** command?
+
+  Subclassing **bdist_mpkg** is currently necessary in order to add
+  additional features to the installation package, such as
+  documentation, examples, tools, etc.
+
+  Currently, the documentation
+  for doing this is the source, and the examples are the source to
+  the **py2app** and `PyObjC`_ ``setup.py`` scripts.
+
+  The API for
+  **bdist_mpkg** is not guaranteed to be stable, so avoid subclassing
+  at this time unless you plan to communicate with the author
+  about your requirements and are willing to make changes to accommodate
+  changes in the API as **bdist_mpkg** improves.
+
+Tools
+-----
+
+By default, the following tools are installed to ``/usr/local/bin``:
+
+**bdist_mpkg**:
+
+    A convenient way to run the **bdist_mpkg** `distutils`_ command.
+    Equivalent to editing the ``setup.py`` in the current
+    directory to import **bdist_mpkg** and running the following
+    command::
+
+        % python setup.py bdist_mpkg --open
+
+    If any options are given, then they are given in place of ``--open``.
+    
+**macho_find**:
+
+    A tool for finding Mach-O object files using **macholib**.
+    The arguments may be files or directories.  The output of this tool is
+    identical to that of the BSD `find`_ command.
+
+**macho_standalone**:
+
+    A tool that makes a valiant attempt to make the given application
+    bundle standalone using **macholib** using machinery similar, but not
+    identical to, what happens when using **py2app**.  This tool modifies
+    the given application bundle in-place, so you may want to make a backup
+    before performing this operation.  This tool works for ANY Mach-O
+    executable bundle, and contains no Python-specific functionality.
+
+**py2applet**:
+
+    A convenient way to run the **py2app** `distutils`_ command without
+    creating a ``setup.py``.  The first python script passed as an
+    argument will be the main script, any additional files or directories
+    will be considered as data files.  If a file with the ``.icns``
+    extension is passed, it will be used as the application's icon.  If
+    a file named ``Info.plist`` is given, it will be used as the template
+    for the application's ``Info.plist``.  The application will be built
+    with the ``--argv-emulation`` on.  It is not possible to pass options
+    to py2applet.  If you need anything more, you should create a
+    ``setup.py`` and use the **py2app** command in the normal fashion.
+
+GUI Tools
+---------
+
+By default, the following GUI tools are installed to
+``/Developer/Applications/Python Tools/py2app``:
+
+**PackageInstaller**:
+
+    A droplet version of the **bdist_mpkg** tool, it does
+    not have any interactivity, so it is not possible to use this tool
+    to pass options other than the default.  Errors and informational
+    messages will go to the Console.
+
+**py2applet**:
+
+    A droplet version of the **py2applet** tool.  It works in
+    exactly the same way and provides no interactivity.  Note that
+    since you have no guarantee of the order of files in the pasteboard,
+    you should drag only one at a time to this script.  Errors and
+    informational messages will go to the console.
+
+----------
+
+Copyright (c) 2004, 2005 Bob Ippolito <bob at redivi.com>.
+
+.. _`pythonmac.org FAQ`: http://pythonmac.org/wiki/FAQ
+.. _`TODO`: http://svn.red-bean.com/bob/py2app/trunk/TODO.txt
+.. _`ZeroLink`: http://developer.apple.com/documentation/DeveloperTools/Conceptual/Build_System/Using_ZeroLink/Using_ZeroLink.html
+.. _`Xcode`: http://developer.apple.com/tools/xcode/
+.. _`PyObjC tutorial`: http://pyobjc.sourceforge.net/doc/tutorial.php
+.. _`GTK+`: http://www.gtk.org/
+.. _`Pango`: http://www.pango.org/
+.. _`PEAK`: http://peak.telecommunity.com/
+.. _`docutils`: http://docutils.sourceforge.net/
+.. _`PIL`: http://www.pythonware.com/products/pil/
+.. _`pydoc`: http://docs.python.org/lib/module-pydoc.html
+.. _`sip`: http://www.riverbankcomputing.co.uk/sip/index.php
+.. _`pyOpenGL`: http://pyopengl.sourceforge.net/
+.. _`import`: http://docs.python.org/ref/import.html
+.. _`distutils`: http://docs.python.org/lib/module-distutils.html
+.. _`wxPython`: http://www.wxpython.org/
+.. _`Tkinter`: http://www.python.org/moin/TkInter
+.. _`pygame`: http://www.pygame.org/
+.. _`PyQt`: http://www.riverbankcomputing.co.uk/pyqt/index.php
+.. _`PyObjC`: http://pyobjc.sourceforge.net/
+.. _`bundlebuilder`: http://www.python.org/moin/BundleBuilder
+.. _`Apple Remote Desktop`: http://www.apple.com/remotedesktop/
+.. _`Slipy`: http://www.versiontracker.com/dyn/moreinfo/macosx/24178
+.. _`py2exe`: http://starship.python.net/crew/theller/py2exe/
+.. _`cx_Freeze`: http://starship.python.net/crew/atuining/cx_Freeze/
+.. _`graphlib`: http://www.personal.psu.edu/staff/i/u/iua1/python/graphlib/html/public/graphlib-module.html
+.. _`Istvan Albert`: http://www.personal.psu.edu/staff/i/u/iua1/
+.. _`find`: x-man-page://1/find
+.. _`install_name_tool`: x-man-page://1/install_name_tool
+.. _`modulefinder`: http://pydoc.org/2.3/modulefinder.html
+.. _`GraphViz`: http://www.research.att.com/sw/tools/graphviz/

examples/PIL/hello.py

+import sys, os
+import Image
+
+print "globals() is %r" % id(globals())
+def somefunc():
+    print "globals() is %r" % id(globals())
+    print "Hello from py2app"
+
+    print "frozen", repr(getattr(sys, "frozen", None))
+
+    print "sys.path", sys.path
+    print "sys.executable", sys.executable
+    print "sys.prefix", sys.prefix
+    print "sys.argv", sys.argv
+    print "os.getcwd()", os.getcwd()
+if __name__ == '__main__':
+    somefunc()

examples/PIL/setup.py

+"""
+Script for building the example.
+
+Usage:
+    python setup.py py2app
+"""
+from setuptools import setup
+
+setup(
+    app=["hello.py"],
+    setup_requires=["py2app"],
+)

examples/PyObjC/ICSharingWatcher/ICSharingWatcher.py

+"""
+Display the useful contents of /var/db/dhcpd_leases
+
+This lets you see what IP addresses are leased out when using
+Internet Connection Sharing
+"""
+
+from PyObjCTools import AppHelper
+
+# import classes required to start application
+import TableModelAppDelegate
+
+# start the event loop
+AppHelper.runEventLoop(argv=[], installInterrupt=False)

examples/PyObjC/ICSharingWatcher/MainMenu.nib/classes.nib

+{
+    IBClasses = (
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {
+            CLASS = TableModelAppDelegate; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {mainWindow = id; }; 
+            SUPERCLASS = NSObject; 
+        }
+    ); 
+    IBVersion = 1; 
+}

examples/PyObjC/ICSharingWatcher/MainMenu.nib/info.nib

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IBDocumentLocation</key>
+	<string>199 472 585 307 0 0 1600 1002 </string>
+	<key>IBEditorPositions</key>
+	<dict>
+		<key>29</key>
+		<string>93 283 318 44 0 0 1280 832 </string>
+	</dict>
+	<key>IBFramework Version</key>
+	<string>387.0</string>
+	<key>IBOpenObjects</key>
+	<array>
+		<integer>21</integer>
+	</array>
+	<key>IBSystem Version</key>
+	<string>8A171</string>
+	<key>IBUsesTextArchiving</key>
+	<true/>
+</dict>
+</plist>

examples/PyObjC/ICSharingWatcher/MainMenu.nib/keyedobjects.nib

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>$archiver</key>
+	<string>NSKeyedArchiver</string>
+	<key>$objects</key>
+	<array>
+		<string>$null</string>
+		<dict>
+			<key>$class</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>497</integer>
+			</dict>
+			<key>NSAccessibilityConnectors</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>494</integer>
+			</dict>
+			<key>NSAccessibilityOidsKeys</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>495</integer>
+			</dict>
+			<key>NSAccessibilityOidsValues</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>496</integer>
+			</dict>
+			<key>NSClassesKeys</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>383</integer>
+			</dict>
+			<key>NSClassesValues</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>384</integer>
+			</dict>
+			<key>NSConnections</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>87</integer>
+			</dict>
+			<key>NSFontManager</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>0</integer>
+			</dict>
+			<key>NSFramework</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>6</integer>
+			</dict>
+			<key>NSNamesKeys</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>344</integer>
+			</dict>
+			<key>NSNamesValues</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>345</integer>
+			</dict>
+			<key>NSNextOid</key>
+			<integer>229</integer>
+			<key>NSObjectsKeys</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>263</integer>
+			</dict>
+			<key>NSObjectsValues</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>343</integer>
+			</dict>
+			<key>NSOidsKeys</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>385</integer>
+			</dict>
+			<key>NSOidsValues</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>386</integer>
+			</dict>
+			<key>NSRoot</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>2</integer>
+			</dict>
+			<key>NSVisibleWindows</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>7</integer>
+			</dict>
+		</dict>
+		<dict>
+			<key>$class</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>5</integer>
+			</dict>
+			<key>NSClassName</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>3</integer>
+			</dict>
+		</dict>
+		<dict>
+			<key>$class</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>4</integer>
+			</dict>
+			<key>NS.string</key>
+			<string>NSApplication</string>
+		</dict>
+		<dict>
+			<key>$classes</key>
+			<array>
+				<string>NSMutableString</string>
+				<string>NSString</string>
+				<string>NSObject</string>
+			</array>
+			<key>$classname</key>
+			<string>NSMutableString</string>
+		</dict>
+		<dict>
+			<key>$classes</key>
+			<array>
+				<string>NSCustomObject</string>
+				<string>NSObject</string>
+			</array>
+			<key>$classname</key>
+			<string>NSCustomObject</string>
+		</dict>
+		<dict>
+			<key>$class</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>4</integer>
+			</dict>
+			<key>NS.string</key>
+			<string>IBCocoaFramework</string>
+		</dict>
+		<dict>
+			<key>$class</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>86</integer>
+			</dict>
+			<key>NS.objects</key>
+			<array>
+				<dict>
+					<key>CF$UID</key>
+					<integer>8</integer>
+				</dict>
+			</array>
+		</dict>
+		<dict>
+			<key>$class</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>85</integer>
+			</dict>
+			<key>NSMaxSize</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>84</integer>
+			</dict>
+			<key>NSMinSize</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>83</integer>
+			</dict>
+			<key>NSScreenRect</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>82</integer>
+			</dict>
+			<key>NSViewClass</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>12</integer>
+			</dict>
+			<key>NSWTFlags</key>
+			<integer>1886912512</integer>
+			<key>NSWindowBacking</key>
+			<integer>2</integer>
+			<key>NSWindowClass</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>11</integer>
+			</dict>
+			<key>NSWindowRect</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>9</integer>
+			</dict>
+			<key>NSWindowStyleMask</key>
+			<integer>14</integer>
+			<key>NSWindowTitle</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>10</integer>
+			</dict>
+			<key>NSWindowView</key>
+			<dict>
+				<key>CF$UID</key>
+				<integer>13</integer>
+			</dict>
+		</dict>