1__all__ = ['runtime', 'pluginBundle', 'registerPlugin']
2import warnings
3
4class Runtime:
5    """
6    Backward compatibility interface.
7
8    This class provides (partial) support for the interface of
9    older versions of PyObjC.
10    """
11    def __getattr__(self, name):
12        warnings.warn("Deprecated: use objc.lookUpClass",
13            DeprecationWarning)
14        import objc
15        if name == '__objc_classes__':
16            return objc.getClassList()
17        elif name == '__kind__':
18            return 'python'
19
20        try:
21            return objc.lookUpClass(name)
22        except objc.nosuchclass_error:
23            raise AttributeError, name
24
25    def __eq__(self, other):
26        return self is other
27
28    def __repr__(self):
29        return "objc.runtime"
30
31runtime = Runtime()
32
33_PLUGINS = {}
34def registerPlugin(pluginName):
35    """
36    Deprecated: use currentBundle()
37
38    Register the current py2app plugin by name and return its bundle
39    """
40    warnings.warn("Deprecated: use objc.currentBundle()", DeprecationWarning)
41    import os
42    import sys
43    path = os.path.dirname(os.path.dirname(os.environ['RESOURCEPATH']))
44    if not isinstance(path, unicode):
45        path = unicode(path, sys.getfilesystemencoding())
46    _PLUGINS[pluginName] = path
47    return pluginBundle(pluginName)
48
49def pluginBundle(pluginName):
50    """
51    Deprecated: use currentBundle()
52
53    Return the main bundle for the named plugin. This should be used
54    only after it has been registered with registerPlugin
55    """
56    warnings.warn("Deprecated: use currentBundle()", DeprecationWarning)
57    from Foundation import NSBundle
58    return NSBundle.bundleWithPath_(_PLUGINS[pluginName])
59