Commits

Anonymous committed bdf6790

Removing old template.

Comments (0)

Files changed (54)

pyobjc-xcode/Doc/XcodeIntegration.txt

-======================
-PyObjC Xcode Templates
-======================
-
-:Author: Bob Ippolito
-:Contact: bob@redivi.com
-
-The PyObjC Xcode Templates offer an alternative to developing
-applications "by hand" using py2app, as described in the
-tutorial.  As of PyObjC 1.3.1, these templates are py2app based,
-so there is no longer a technical reason not to use them.
-
-.. contents::
-
-Installing
-----------
-
-If you have installed PyObjC 1.3.1 or later using the installer, then
-the Xcode templates are already installed.  
-
-If you have installed any version of PyObjC prior to 1.3.1, then you
-may have old Xcode templates installed.  These Xcode templates named
-"Cocoa-Python Application" and "Cocoa-Python Document Based Application"
-should NOT be used, and it would be wise to remove them.  They can
-be found here::
-
-    /Library/Application Support/Apple/Developer Tools/Project Templates
-
-If you want to install the packages using setuptools use the following 
-commands::
-
-   $ easy_install pyobjc-xcode
-   $ pyobjc-xcode-install
-
-The latter command makes the templates available to Xcode as the former installs
-the templates and support code in a location where Xcode won't pick them up.
-
-Removing the templates is easy as well, but requires some manual intervention
-at this time. Use ``pyobjc-xcode-uninstall`` to remove the templates from 
-Xcode's search path, and then install the ``pyobjc-xcode`` egg the usual way.
-
-
-
-
-Notes
------
-
-- These templates are brand new in PyObjC 1.3.1 and haven't had much
-  use yet.  If you think that you have found a bug or would like them to be
-  changed in some way, please speak up on the `pyobjc-dev`_
-  mailing list, and/or `report a bug`_.
-
-.. _`pyobjc-dev`: http://lists.sourceforge.net/lists/listinfo/pyobjc-dev
-.. _`report a bug`: http://sourceforge.net/tracker/?group_id=14534&atid=114534
-
-
-- The Python interpreter used by the templates is determined by the
-  first line of the ``setup.py`` file.  By default, it points to::
-
-      #!/usr/bin/env python
-
-  This means that whichever Python that comes first on the ``PATH``
-  will be used.  This will normally be the Python 2.3 interpreter
-  that ships with Mac OS X.  If you would like to use a different
-  interpreter, you have two choices:
-
-  1. Edit the first line of ``setup.py`` to point to the desired
-     interpreter explicitly, for example::
-
-         #!/usr/local/bin/python2.4
-
-     This change must be done to every project that you use the
-     template from.  Alternatively, you can make this change
-     to the templates themselves so that this is set for all
-     new projects.  See the Installing section above for the
-     location of these templates.  If you choose to do this,
-     edit the ``setup.py`` directly.  Do not open the
-     ``.xcode`` project in the template, as Xcode templates
-     can be rather fragile.
-
-  2. Change your ``PATH`` environment variable so that the location
-     of your Python interpreter appears before the others.  Since
-     LaunchServices and thus Xcode is not started by your user shell,
-     you will need to specify it in a plist.  See `QA1067`_, 
-     `Runtime Configuration: Environment Variables`_, and the 
-     `EnvironmentPrefs`_ System Preferences plug-in example that
-     comes with PyObjC for more information about how to do this.
-
-.. _`QA1067`: http://developer.apple.com/qa/qa2001/qa1067.html
-.. _`Runtime Configuration: Environment Variables`: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Concepts/EnvironmentVars.html
-.. _`EnvironmentPrefs`: file:///Developer/Python/PyObjC/Examples/Plugins/EnvironmentPrefs
-
-     This change will be specific to your user account, and will
-     take effect globally, which may or may not be a good thing.
-
-- The Clean command currently does not remove everything, if you
-  want to ensure that the project has actually been completely
-  cleaned, then you should remove the ``build`` folder yourself.
-
-- Like Xcode, the built product and temporary files will both end
-  up in the ``build`` folder unless explicitly specified that they
-  should go elsewhere.  When not using these templates, py2app
-  would normally put the result in a ``dist`` folder.
-
-- If you need to include non-system frameworks or dylibs that are not otherwise
-  referenced by a Python extension, then link to them from an Objective-C
-  plug-in.  py2app will find them and put them into your application!
-  See PyObjC Mixed Application below for more information about using
-  plug-ins to integrate non-Python code into your application.
-
-Groups
-------
-
-The PyObjC Xcode templates use py2app to build applications,
-but they parse the ``.xcode`` project file to determine
-how they should be built, rather than directly in the
-``setup.py``.  The parser, in ``PyObjCTools.XcodeSupport``,
-gives special meaning to several groups.  If these groups
-are renamed or removed, your project may not build correctly!
-
-Main Script:
-    This group should contain exactly one file, the main script
-    of your application.  The default main script in the template
-    generally does not need to be changed.
-
-    If you need to ensure that additional code is imported, simply
-    place it in the Classes group.  You shouldn't need to modify
-    your main script.
-
-    ONLY the main script should be in this group.
-
-Resources:
-    Every file in this group goes into the ``Resources`` folder
-    inside of your application bundle.
-
-    Any ``.nib`` files that are in this folder will
-    be parsed with ``PyObjCTools.NibClassBuilder.extractClasses``
-    by  the main script before any modules in the Classes group
-    are imported, and before the run loop is started.  You should
-    not need to call ``extractClasses`` manually in your code.
-
-    Source code should not go in here.
-    
-Classes:
-    Modules in the classes group will be imported by the main
-    script in the order that they appear in the Xcode project,
-    after all classes are extracted from the nibs.
-
-    Every Python module in this group is guaranteed to be scanned
-    by py2app for dependencies.
-
-Other Sources:
-    This group is not actually special.  You may put anything you
-    want in this group.  It is used by the templates to store
-    files and source code that do not fit into any of the above
-    categories, such as the ``Info.plist`` and the ``setup.py``.
-
-    setup.py:
-        This is the script that is actually used to build your
-        project.  It may also be used from the command line
-        either directly or via ``xcodebuild``.  Read the file
-        for more instructions.  This script must not be renamed
-        or removed.
-
-        If you need to customize the py2app or distutils
-        build process, you should modify the ``setup_options``
-        dict before the ``setup(...)`` function is called.
-
-    Info.plist:
-        When present, this file is used as a template for your
-        application's ``Info.plist``.  If you rename or delete
-        it, then it will not be used and plist will be
-        generated by py2app.  For information about what
-        can go in this plist, see
-        `Runtime Configuration: Property List Key Reference`__.
-
-.. __: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Concepts/PListKeys.html
-
-Targets
--------
-
-Development:
-    This target will use py2app ``--alias`` build mode.  Executables
-    built with this mechanism are produced very quickly, and use the
-    sources in-place via symlinks and ``sys.path`` manipulations.
-    These executables are not redistributable, much like development
-    executables produced by Xcode when using Zero-Link.
-
-Deployment:
-    This target will use py2app's default build mode, ``--standalone``.
-    This will create a standalone bundle out of your application that is
-    redistributable.  Everything that py2app determines to be
-    needed by your application will be included in the executable,
-    including Python itself, extensions you use, and dynamic
-    libraries or frameworks that are linked to by these extensions.
-    
-    If you are using a Python distributed by
-    Apple, then it will be built in ``--semi-standalone`` mode.
-    This means that Python and its standard library *will not*
-    be included in the application.
-
-    Using the Deployment *target* does not automatically
-    imply that you are using the Deployment *build style*.  This is
-    only relevant when using the PyObjC Mixed Application template,
-    or are otherwise using the same project to compile non-Python
-    source code.  To change the current build style, Get Info on the
-    project.  The build style has no effect on Python code.
-
-Custom Executable
------------------
-
-The custom executable enables for your built application to be run from Xcode.
-
-If you rename your main script or fiddle around with your ``Info.plist``,
-the path to your application may change and this will no longer work.
-If that is the case, use Get Info on the custom executable and change
-the Arguments to point to the correct path.
-
-By default, executables are launched with the ``USE_PDB`` environment variable
-set for both Development and Deployment targets.  This turns on verbose stack
-traces whenever an exception crosses the PyObjC bridge, and will drop you at
-a pdb prompt in the console when an uncaught exception occurs.
-
-Other useful environment variables that you can set, such as ``NSZombieEnabled``,
-as well as all kinds of other debugging tricks you should know are covered
-in `TN2124: Mac OS X Debugging Magic`__.
-
-.. __: http://developer.apple.com/technotes/tn2004/tn2124.html
-
-If Xcode screwed up and didn't create a Custom Executable, which is not
-beyond the realm of possibility, then you can create one as follows:
-
-1. Create a Custom Executable for ``/usr/bin/env`` (yes, Xcode is dumb)
-2. Set that it runs from the Built Product directory
-3. Use ``YourProject.app/Contents/MacOS/YourProject`` as the first (and only) argument
-4. Optionally set the ``USE_PDB`` (or any other) environment variables
-
-Note that when debugging using gdb, you'll get a trap signal because
-``/usr/bin/env`` will be ``execve``'ing your application.  Unfortunately,
-there's nothing we can do from the template, because Xcode can only create
-Custom Executables to absolute paths.  However, you can probably modify
-yours such that it points directly to your built application after it
-has been built once.
-
-Custom executables are specific to a particular user in Xcode, so anything
-you do to this part of the template won't be seen by anyone else unless
-they happen to have the same short user name as you.
-
-PyObjC Application
-------------------
-
-This is a simple template that has a window and an application delegate.
-
-PyObjC Document Based Application
----------------------------------
-
-This is template demonstrates a Document-based application written in Python.
-It is a simple text editor (like the TinyTinyEdit example).
-
-PyObjC Mixed Application
-------------------------
-
-This template contains both Objective-C and Python code.  The Objective-C code
-is built as a "ProjectNamePlugIn.bundle" plug-in in a separate target.  The plug-in
-is placed in the ``Resources`` directory of your application.  A wrapper script
-in the Classes group, "ProjectNamePlugIn.py" can be imported from Python and will
-contain all of the Objective-C classes referenced in the plug-in (even if there
-is more than just the example ``ProjectNamePlugIn`` class).
-
-The example class implements a simple method, ``-(BOOL)plugInLoaded`` which will
-always return ``YES``.  The Python application delegate creates an instances of
-this class, and will beep when the application has finished launching if the
-plug-in loaded correctly.  If it didn't load correctly, you would get an exception,
-but that shouldn't happen :)
-
-Note that this template doesn't have any special machinery behind it.  If you find
-that you later need to add Objective-C code to a project that you started with
-one of the other templates, you can do the following:
-
-1. Create a new Objective-C loadable bundle target
-2. Make the Development and Deployment targets depend on this target
-3. Drag the product loadable bundle into the Resources group
-4. Create a wrapper module, that uses ``objc.loadBundle(...)`` in the
-   Classes group (see the example in the template).
-
-Note that switching between Development and Deployment targets does
-not imply that you are switching to the build style of the same name.
-See the Targets section for more information.

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/ArchiveGraph.py

-#!/usr/bin/env python
-
-import sys
-import os
-import glob
-from altgraph.compat import *
-from Foundation import *
-from altgraph.ObjectGraph import ObjectGraph
-
-class attrdict(dict):
-    def __getattr__(self, attr):
-        try:
-            return self[attr]
-        except KeyError, e:
-            raise AttributeError(*e.args)
-
-class Object(object):
-    def __init__(self, guid, dct):
-        self.graphident = self._guid = guid
-        self._prototype = dct
-
-    def __repr__(self):
-        return "<%s guid=%s>" % (type(self).__name__, self._guid)
-
-    def __hash__(self):
-        return hash(self._guid)
-
-    def __eq__(self, other):
-        return self._guid == other._guid
-
-class ArchiveGraph(ObjectGraph):
-    def __init__(self, graph=None, debug=0):
-        super(ArchiveGraph, self).__init__(graph=graph, debug=debug)
-        self.root = None
-        self.classes = attrdict()
-        self.classbuckets = attrdict()
-
-    def parseDict(self, d):
-        newobjects = []
-        for guid, dct in d[u'objects'].iteritems():
-            isa = dct[u'isa']
-            cls = self.getClass(isa)
-            node = self.createNode(cls, guid, dct)
-            self.classbuckets[isa].append(node)
-            newobjects.append(node)
-        self.root = self.findNode(d[u'rootObject'])
-        self.createReference(None, self.root, 'root')
-        for obj in newobjects:
-            self.resolveObject(obj)
-            
-    def resolveObject(self, obj):
-        d = self.resolveItem(obj._prototype, caller=obj)
-        ident = d.get('path') or d.get('name')
-        if ident:
-            obj.identifier = '%s(%s)' % (type(obj).__name__, ident)
-        else:
-            obj.identifier  = repr(obj)
-        for key, value in d.iteritems():
-            setattr(obj, str(key), value)
-
-    def resolveItem(self, item, caller=None, edge_data='unknown'):
-        if isinstance(item, (dict, NSDictionary)):
-            d = attrdict()
-            for key, value in item.iteritems():
-                key = self.resolveItem(key, caller=caller, edge_data=edge_data)
-                value = self.resolveItem(value, caller=caller, edge_data=str(key))
-                d[key] = value
-            item = d
-        elif isinstance(item, (unicode, NSString)):
-            ref = self.findNode(item)
-            if ref is not None:
-                self.createReference(caller, ref, edge_data=edge_data)
-                item = ref
-        elif isinstance(item, (list, tuple, NSArray)):
-            edge_data = '[%s]' % (edge_data,)
-            item = [self.resolveItem(i, caller=caller, edge_data=edge_data) for i in item]
-        return item
-    
-    def getClass(self, isa):
-        cls = self.classes.get(isa)
-        if cls is None:
-            cls = self.classes[isa] = type(str(isa), (Object,), {})
-            self.classbuckets[isa] = []
-        return cls
-
-    def __getitem__(self, item):
-        return self.findNode(item)
-
-    def fromPath(cls, fn):
-        self = cls()
-        self.parseDict(openDict(fn))
-        return self
-    fromPath = classmethod(fromPath)
-
-    def itergraphreport(self, name='G'):
-        nodes = map(self.graph.describe_node, self.graph.iterdfs(self))
-        describe_edge = self.graph.describe_edge
-        return itergraphreport(nodes, describe_edge, name=name)
-
-    def graphreport(self, fileobj=None):
-        if fileobj is None:
-            fileobj = sys.stdout
-        fileobj.writelines(self.itergraphreport())
-
-def itergraphreport(nodes, describe_edge, name='G'):
-    edges = deque()
-
-    def nodevisitor(node, data, outgoing, incoming):
-        if data is None:
-            data = node
-        ident = getattr(data, 'identifier', None)
-        if ident is None:
-            ident = repr(data)
-        return {'label': ident}
-
-    def edgevisitor(edge, data, head, tail):
-        return {'label': str(data)}
-
-    yield 'digraph %s {\n' % (name,)
-    attr = dict(rankdir='LR', concentrate='true')
-    cpatt  = '%s="%s"'
-    for item in attr.iteritems():
-        yield '\t%s;\n' % (cpatt % item,)
-
-    # create sets for subgraph, write out descriptions
-    for (node, data, outgoing, incoming) in nodes:
-        # update edges
-        for edge in imap(describe_edge, outgoing):
-            edges.append(edge)
-
-        # describe node
-        yield '\t"%s" [%s];\n' % (
-            node,
-            ','.join([
-                (cpatt % item) for item in
-                nodevisitor(node, data, outgoing, incoming).iteritems()
-            ]),
-        )
-
-    def do_graph(edges, tabs):
-        edgestr = tabs + '"%s" -> "%s" [%s];\n'
-        # describe edge
-        for (edge, data, head, tail) in edges:
-            attribs = edgevisitor(edge, data, head, tail)
-            yield edgestr % (
-                head,
-                tail,
-                ','.join([(cpatt % item) for item in attribs.iteritems()]),
-            )
-
-    for s in do_graph(edges, '\t'):
-        yield s
-
-    yield '}\n'
-
-def openDict(fn):
-    if not isinstance(fn, unicode):
-        fn = unicode(fn, 'utf-8')
-    return NSDictionary.dictionaryWithContentsOfFile_(fn)
-
-XCODE_20 = 1000
-XCODE_21 = 999
-
-def _xcodeFiles(base):
-    for fn in os.listdir(base):
-        ext = os.path.splitext(fn)[1]
-        if ext == '.xcode':
-            yield XCODE_20, os.path.join(base, fn, 'project.pbxproj')
-        elif ext == '.xcodeproj':
-            yield XCODE_21, os.path.join(base, fn, 'project.pbxproj')
-
-def xcodeFiles(base):
-    lst = list(_xcodeFiles(base))
-    lst.sort()
-    return [path for (ver, path) in lst]
-        
-def main():
-    fn = (sys.argv[1:2] or xcodeFiles('.'))[0]
-    o = ArchiveGraph.fromPath(fn)
-    o.graphreport()
-    return o
-
-if __name__ == '__main__':
-    o = main()

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/Xcode.py

-import os
-from altgraph.compat import *
-
-class Xcode(object):
-    def __init__(self, project, archive, env):
-        self.project = project
-        self.archive = archive
-        self.env = dict(
-            BUILT_PRODUCTS_DIR='build',
-            TARGET_TEMP_DIR=os.path.join('build', project + '.py2app.build'),
-        )
-        self.env.update(env)
-
-    def py2app_argv(self, argv):
-        action = self.env.get('ACTION', '').strip()
-        if not action:
-            return argv
-        if action == 'build':
-            action = 'py2app'
-        rval = [argv[0], action]
-        return rval
-
-    def findGroup(self, groupName):
-        for group in self.archive.root.mainGroup.children:
-            if group.name == groupName:
-                return group
-        raise ValueError("%r group not found" % (groupName,))
-    
-    def findMainScript(self):
-        name = u'Main Script'
-        group = self.findGroup(name)
-        if len(group.children) != 1:
-            raise ValueError("Expecting exactly 1 item in %r group, found %d" % (name, len(group.children),))
-        return unicode(group.children[0].path).encode('utf8')
-
-    def iterNIBFiles(self):
-        name = u'Resources'
-        group = self.findGroup(name)
-        for ref in group.children:
-            if ref.isa == u'PBXFileReference':
-                name, ext = os.path.splitext(ref.path)
-            elif ref.isa == u'PBXVariantGroup':
-                name, ext = os.path.splitext(ref.name)
-            else:
-                continue
-            if ext == u'.nib':
-                yield unicode(os.path.basename(name)).encode('utf8')
-
-    def iterModules(self):
-        name = u'Classes'
-        group = self.findGroup(name)
-        for ref in group.children:
-            if ref.isa != u'PBXFileReference':
-                raise ValueError('Only file references are allowed in Classes')
-            yield os.path.splitext(unicode(ref.path).encode('utf8'))[0]
-
-    def getPlist(self, nibFiles, modules):
-        try:
-            import plistlib
-            plist = plistlib.Plist.fromFile('Info.plist')
-        except IOError:
-            plist = {}
-
-        plist.update(dict(
-            PyObjCXcode=dict(
-                NIBFiles=nibFiles,
-                Modules=modules,
-            ),
-        ))
-
-        return plist
-    
-    def getTarget(self, nibFiles, modules):
-        return dict(
-            script=self.findMainScript(),
-            plist=self.getPlist(nibFiles, modules),
-        )
-
-    def iterResources(self):
-        name = u'Resources'
-        group = self.findGroup(name)
-        refs = iter(group.children)
-        while True:
-            for ref in refs:
-                children = getattr(ref, 'children', None)
-                if children is not None:
-                    refs = chain(ref.children, refs)
-                    break
-                path = ref.path
-                sourceTree = self.env.get(getattr(ref, 'sourceTree', None))
-                dirname = unicode(os.path.dirname(path))
-                if sourceTree:
-                    path = os.path.join(unicode(sourceTree, 'utf-8'), path)
-                yield dirname, [unicode(path).encode('utf8')]
-            else:
-                break
-
-    def py2app_setup_options(self, buildstyle):
-        nibFiles = list(self.iterNIBFiles())
-        modules = list(self.iterModules())
-        py2app = dict(includes=modules)
-        resources = list(self.iterResources())
-        if self.env.get('BUILD_STYLE') == 'Development':
-            py2app['alias'] = True
-        py2app['dist_dir'] = self.env['BUILT_PRODUCTS_DIR']
-        py2app['bdist_base'] = self.env['TARGET_TEMP_DIR']
-        rval = dict(
-            data_files=resources,
-            options=dict(py2app=py2app),
-        )
-        rval[buildstyle] = [self.getTarget(nibFiles, modules)]
-
-        return rval

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/XcodeProj.py

-import os
-from altgraph.compat import *
-
-class Xcode(object):
-    def __init__(self, project, archive, env):
-        self.project = project
-        self.archive = archive
-        self.env = dict(
-            BUILT_PRODUCTS_DIR='build',
-            TARGET_TEMP_DIR=os.path.join('build', project + '.py2app.build'),
-        )
-        self.env.update(env)
-
-    def py2app_argv(self, argv):
-        action = self.env.get('ACTION', '').strip()
-        if not action:
-            return argv
-        if action == 'build':
-            action = 'py2app'
-        rval = [argv[0], action]
-        return rval
-
-    def findGroup(self, groupName):
-        for group in self.archive.root.mainGroup.children:
-            if group.name == groupName:
-                return group
-        raise ValueError("%r group not found" % (groupName,))
-    
-    def findMainScript(self):
-        name = u'Main Script'
-        group = self.findGroup(name)
-        if len(group.children) != 1:
-            raise ValueError("Expecting exactly 1 item in %r group, found %d" % (name, len(group.children),))
-        return unicode(group.children[0].path).encode('utf8')
-
-    def iterNIBFiles(self):
-        name = u'Resources'
-        group = self.findGroup(name)
-        for ref in group.children:
-            if ref.isa == u'PBXFileReference':
-                name, ext = os.path.splitext(ref.path)
-            elif ref.isa == u'PBXVariantGroup':
-                name, ext = os.path.splitext(ref.name)
-            else:
-                continue
-            if ext == u'.nib':
-                yield unicode(os.path.basename(name)).encode('utf8')
-
-    def iterModules(self):
-        name = u'Classes'
-        group = self.findGroup(name)
-        for ref in group.children:
-            if ref.isa != u'PBXFileReference':
-                raise ValueError('Only file references are allowed in Classes')
-            yield os.path.splitext(unicode(ref.path).encode('utf8'))[0]
-
-    def getPlist(self, nibFiles, modules):
-        try:
-            import plistlib
-            plist = plistlib.Plist.fromFile('Info.plist')
-        except IOError:
-            plist = {}
-
-        plist.update(dict(
-            PyObjCXcode=dict(
-                NIBFiles=nibFiles,
-                Modules=modules,
-            ),
-        ))
-
-        return plist
-    
-    def getTarget(self, nibFiles, modules):
-        return dict(
-            script=self.findMainScript(),
-            plist=self.getPlist(nibFiles, modules),
-        )
-
-    def iterResources(self):
-        name = u'Resources'
-        group = self.findGroup(name)
-        refs = iter(group.children)
-        while True:
-            for ref in refs:
-                children = getattr(ref, 'children', None)
-                if children is not None:
-                    refs = chain(ref.children, refs)
-                    break
-                path = ref.path
-                sourceTree = self.env.get(getattr(ref, 'sourceTree', None))
-                dirname = unicode(os.path.dirname(path))
-                if sourceTree:
-                    path = os.path.join(unicode(sourceTree, 'utf-8'), path)
-                yield dirname, [unicode(path).encode('utf8')]
-            else:
-                break
-
-    def py2app_setup_options(self, buildstyle):
-        nibFiles = list(self.iterNIBFiles())
-        modules = list(self.iterModules())
-        py2app = dict(includes=modules)
-        resources = list(self.iterResources())
-        if self.env.get('BUILD_STYLE') == 'Development':
-            py2app['alias'] = True
-        py2app['dist_dir'] = self.env['BUILT_PRODUCTS_DIR']
-        py2app['bdist_base'] = self.env['TARGET_TEMP_DIR']
-        rval = dict(
-            data_files=resources,
-            options=dict(py2app=py2app),
-        )
-        rval[buildstyle] = [self.getTarget(nibFiles, modules)]
-
-        return rval

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/__init__.py

-from api import *

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/api.py

-import os
-import glob
-
-def xcodeFromEnvironment(project, env):
-    from PyObjCTools.XcodeSupport import ArchiveGraph
-    from PyObjCTools.XcodeSupport import Xcode
-    from PyObjCTools.XcodeSupport import XcodeProj
-    path = os.path.join(project, 'project.pbxproj')
-    if not os.path.exists(path):
-        path = ArchiveGraph.xcodeFiles('.')[0]
-    projType = os.path.splitext(os.path.dirname(path))[1]
-    if projType == '.xcodeproj':
-        mod = XcodeProj
-    elif projType == '.xcode':
-        mod = Xcode
-    return mod.Xcode(project, ArchiveGraph.ArchiveGraph.fromPath(path), env)
-
-def main():
-    import sys
-    return xcodeFromEnvironment(sys.argv[1], dict(os.environ))
-
-if __name__ == '__main__':
-    main()

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Cocoa/Python NIB class.pbfiletemplate/TemplateInfo.plist

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>Description</key>
-	<string>A Python Cocoa-class file, imports Foundation. Use this for classes defined in a NIB file.</string>
-	<key>MainTemplateFile</key>
-	<string>class.py</string>
-</dict>
-</plist>

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Cocoa/Python NIB class.pbfiletemplate/class.py

-#
-#  «FILENAME»
-#  «PROJECTNAME»
-#
-#  Created by «FULLUSERNAME» on «DATE».
-#  Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved.
-#
-
-from Foundation import *
-from AppKit import *
-
-from PyObjCTools import NibClassBuilder
-
-class «FILEBASENAMEASIDENTIFIER»(NibClassBuilder.AutoBaseClass):
-    pass

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Cocoa/Python class.pbfiletemplate/TemplateInfo.plist

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>Description</key>
-	<string>A Python Cocoa-class file, imports Foundation.</string>
-	<key>MainTemplateFile</key>
-	<string>class.py</string>
-</dict>
-</plist>

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Cocoa/Python class.pbfiletemplate/class.py

-#
-#  «FILENAME»
-#  «PROJECTNAME»
-#
-#  Created by «FULLUSERNAME» on «DATE».
-#  Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved.
-#
-
-from Foundation import *
-
-class «FILEBASENAMEASIDENTIFIER» (NSObject):
-    pass

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Pure Python/Python module.pbfiletemplate/TemplateInfo.plist

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>Description</key>
-	<string>A Python module</string>
-	<key>MainTemplateFile</key>
-	<string>module.py</string>
-</dict>
-</plist>

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Pure Python/Python module.pbfiletemplate/module.py

-#
-#  «FILENAME»
-#  «PROJECTNAME»
-#
-#  Created by «FULLUSERNAME» on «DATE».
-#  Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved.
-#

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Pure Python/Python tool.pbfiletemplate/TemplateInfo.plist

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>Description</key>
-	<string>A Python script</string>
-	<key>MainTemplateFile</key>
-	<string>tool.py</string>
-</dict>
-</plist>

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/File Templates/Pure Python/Python tool.pbfiletemplate/tool.py

-#!/usr/bin/env python2.3
-#
-#  «FILENAME»
-#  «PROJECTNAME»
-#
-#  Created by «FULLUSERNAME» on «DATE».
-#  Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved.
-#

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/Project Templates/Application/PyObjC Application/English.lproj/MainMenu.nib/classes.nib

-{
-    IBClasses = (
-        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
-        {
-            CLASS = �PROJECTNAMEASIDENTIFIER�AppDelegate; 
-            LANGUAGE = ObjC; 
-            SUPERCLASS = NSObject; 
-        }
-    ); 
-    IBVersion = 1; 
-}

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/Project Templates/Application/PyObjC Application/English.lproj/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>69 44 356 240 0 0 1280 832 </string>
-	<key>IBEditorPositions</key>
-	<dict>
-		<key>29</key>
-		<string>69 289 318 44 0 0 1280 832 </string>
-	</dict>
-	<key>IBFramework Version</key>
-	<string>364.0</string>
-	<key>IBOpenObjects</key>
-	<array>
-		<integer>21</integer>
-		<integer>29</integer>
-	</array>
-	<key>IBSystem Version</key>
-	<string>7U16</string>
-	<key>IBUsesTextArchiving</key>
-	<true/>
-</dict>
-</plist>

pyobjc-xcode/Lib/PyObjCTools/XcodeSupport/template-data/Project Templates/Application/PyObjC Application/English.lproj/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>406</integer>
-			</dict>
-			<key>NSClassesKeys</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>301</integer>
-			</dict>
-			<key>NSClassesValues</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>302</integer>
-			</dict>
-			<key>NSConnections</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>21</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>275</integer>
-			</dict>
-			<key>NSNamesValues</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>276</integer>
-			</dict>
-			<key>NSNextOid</key>
-			<integer>248</integer>
-			<key>NSObjectsKeys</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>187</integer>
-			</dict>
-			<key>NSObjectsValues</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>274</integer>
-			</dict>
-			<key>NSOidsKeys</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>303</integer>
-			</dict>
-			<key>NSOidsValues</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>304</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>20</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>19</integer>
-			</dict>
-			<key>NSMaxSize</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>18</integer>
-			</dict>
-			<key>NSMinSize</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>17</integer>
-			</dict>
-			<key>NSScreenRect</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>16</integer>
-			</dict>
-			<key>NSViewClass</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>12</integer>
-			</dict>
-			<key>NSWTFlags</key>
-			<integer>1881669632</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>
-		<string>{{182, 364}, {480, 360}}</string>
-		<string>Window</string>
-		<string>NSWindow</string>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>4</integer>
-			</dict>
-			<key>NS.string</key>
-			<string>View</string>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>15</integer>
-			</dict>
-			<key>NSFrame</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>14</integer>
-			</dict>
-			<key>NSNextResponder</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>0</integer>
-			</dict>
-		</dict>
-		<string>{{1, 9}, {480, 360}}</string>
-		<dict>
-			<key>$classes</key>
-			<array>
-				<string>NSView</string>
-				<string>NSResponder</string>
-				<string>NSObject</string>
-			</array>
-			<key>$classname</key>
-			<string>NSView</string>
-		</dict>
-		<string>{{0, 0}, {1280, 832}}</string>
-		<string>{213, 129}</string>
-		<string>{3.40282e+38, 3.40282e+38}</string>
-		<dict>
-			<key>$classes</key>
-			<array>
-				<string>NSWindowTemplate</string>
-				<string>NSObject</string>
-			</array>
-			<key>$classname</key>
-			<string>NSWindowTemplate</string>
-		</dict>
-		<dict>
-			<key>$classes</key>
-			<array>
-				<string>NSMutableSet</string>
-				<string>NSSet</string>
-				<string>NSObject</string>
-			</array>
-			<key>$classname</key>
-			<string>NSMutableSet</string>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>186</integer>
-			</dict>
-			<key>NS.objects</key>
-			<array>
-				<dict>
-					<key>CF$UID</key>
-					<integer>22</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>36</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>41</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>47</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>52</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>58</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>63</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>69</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>73</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>78</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>83</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>87</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>92</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>97</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>103</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>108</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>113</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>118</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>123</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>128</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>133</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>138</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>143</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>147</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>151</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>155</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>161</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>166</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>171</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>176</integer>
-				</dict>
-				<dict>
-					<key>CF$UID</key>
-					<integer>181</integer>
-				</dict>
-			</array>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>35</integer>
-			</dict>
-			<key>NSLabel</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>34</integer>
-			</dict>
-			<key>NSSource</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>23</integer>
-			</dict>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>33</integer>
-			</dict>
-			<key>NSKeyEquiv</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>26</integer>
-			</dict>
-			<key>NSKeyEquivModMask</key>
-			<integer>1048576</integer>
-			<key>NSMenu</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>24</integer>
-			</dict>
-			<key>NSMixedImage</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>31</integer>
-			</dict>
-			<key>NSMnemonicLoc</key>
-			<integer>2147483647</integer>
-			<key>NSOnImage</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>27</integer>
-			</dict>
-			<key>NSTitle</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>25</integer>
-			</dict>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>200</integer>
-			</dict>
-			<key>NSMenuItems</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>197</integer>
-			</dict>
-			<key>NSName</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>199</integer>
-			</dict>
-			<key>NSTitle</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>196</integer>
-			</dict>
-		</dict>
-		<string>Minimize</string>
-		<string>m</string>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>30</integer>
-			</dict>
-			<key>NSClassName</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>28</integer>
-			</dict>
-			<key>NSResourceName</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>29</integer>
-			</dict>
-		</dict>
-		<string>NSImage</string>
-		<string>NSMenuCheckmark</string>
-		<dict>
-			<key>$classes</key>
-			<array>
-				<string>NSCustomResource</string>
-				<string>%NSCustomResource</string>
-				<string>NSObject</string>
-			</array>
-			<key>$classname</key>
-			<string>NSCustomResource</string>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>30</integer>
-			</dict>
-			<key>NSClassName</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>28</integer>
-			</dict>
-			<key>NSResourceName</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>32</integer>
-			</dict>
-		</dict>
-		<string>NSMenuMixedState</string>
-		<dict>
-			<key>$classes</key>
-			<array>
-				<string>NSMenuItem</string>
-				<string>NSObject</string>
-			</array>
-			<key>$classname</key>
-			<string>NSMenuItem</string>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>4</integer>
-			</dict>
-			<key>NS.string</key>
-			<string>performMiniaturize:</string>
-		</dict>
-		<dict>
-			<key>$classes</key>
-			<array>
-				<string>NSNibControlConnector</string>
-				<string>NSNibConnector</string>
-				<string>NSObject</string>
-			</array>
-			<key>$classname</key>
-			<string>NSNibControlConnector</string>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>35</integer>
-			</dict>
-			<key>NSLabel</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>40</integer>
-			</dict>
-			<key>NSSource</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>37</integer>
-			</dict>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>33</integer>
-			</dict>
-			<key>NSKeyEquiv</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>39</integer>
-			</dict>
-			<key>NSKeyEquivModMask</key>
-			<integer>1048576</integer>
-			<key>NSMenu</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>24</integer>
-			</dict>
-			<key>NSMixedImage</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>31</integer>
-			</dict>
-			<key>NSMnemonicLoc</key>
-			<integer>2147483647</integer>
-			<key>NSOnImage</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>27</integer>
-			</dict>
-			<key>NSTitle</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>38</integer>
-			</dict>
-		</dict>
-		<string>Bring All to Front</string>
-		<string></string>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>4</integer>
-			</dict>
-			<key>NS.string</key>
-			<string>arrangeInFront:</string>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>35</integer>
-			</dict>
-			<key>NSLabel</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>46</integer>
-			</dict>
-			<key>NSSource</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>42</integer>
-			</dict>
-		</dict>
-		<dict>
-			<key>$class</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>33</integer>
-			</dict>
-			<key>NSKeyEquiv</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>45</integer>
-			</dict>
-			<key>NSKeyEquivModMask</key>
-			<integer>1048576</integer>
-			<key>NSMenu</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>43</integer>
-			</dict>
-			<key>NSMixedImage</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>31</integer>
-			</dict>
-			<key>NSMnemonicLoc</key>
-			<integer>2147483647</integer>
-			<key>NSOnImage</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>27</integer>
-			</dict>
-			<key>NSTitle</key>
-			<dict>
-				<key>CF$UID</key>
-				<integer>44</integer>
-			</dict>
-		</dict>
-		<dict>