1__all__ = ['runtime', 'pluginBundle', 'registerPlugin', 'splitStruct', '_loadFunctionList']
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 __repr__(self):
26        return "objc.runtime"
27
28runtime = Runtime()
29
30_PLUGINS = {}
31def registerPlugin(pluginName):
32    """
33    Deprecated: use currentBundle()
34
35    Register the current py2app plugin by name and return its bundle
36    """
37    warnings.warn("Deprecated: use objc.currentBundle()", DeprecationWarning)
38    import os
39    import sys
40    path = os.path.dirname(os.path.dirname(os.environ['RESOURCEPATH']))
41    if sys.version_info[0] == 2 and not isinstance(path, unicode):
42        path = unicode(path, sys.getfilesystemencoding())
43    _PLUGINS[pluginName] = path
44    return pluginBundle(pluginName)
45
46def pluginBundle(pluginName):
47    """
48    Deprecated: use currentBundle()
49
50    Return the main bundle for the named plugin. This should be used
51    only after it has been registered with registerPlugin
52    """
53    warnings.warn("Deprecated: use currentBundle()", DeprecationWarning)
54    import objc
55    NSBundle = objc.lookUpClass('NSBundle')
56    return NSBundle.bundleWithPath_(_PLUGINS[pluginName])
57
58def splitStruct(value):
59    warnings.warn("Deprecated: use splitStructSignature()", DeprecationWarning)
60    import objc
61    return objc.splitStructSignature(value)
62
63def _loadFunctionList(*args, **kwds):
64    warnings.warn("Deprecated: use loadFunctionList()", DeprecationWarning)
65    import objc
66    objc.loadFunctionList(*args, **kwds)
67