Source

pyobjc / pyobjc-core / Lib / objc / _compat.py

__all__ = ['runtime', 'pluginBundle', 'registerPlugin', 'splitStruct', '_loadFunctionList']
import warnings

class Runtime:
    """
    Backward compatibility interface.

    This class provides (partial) support for the interface of
    older versions of PyObjC.
    """
    def __getattr__(self, name):
        warnings.warn("Deprecated: use objc.lookUpClass",
            DeprecationWarning)
        import objc
        if name == '__objc_classes__':
            return objc.getClassList()
        elif name == '__kind__':
            return 'python'

        try:
            return objc.lookUpClass(name)
        except objc.nosuchclass_error:
            raise AttributeError(name)

    def __repr__(self):
        return "objc.runtime"

runtime = Runtime()

_PLUGINS = {}
def registerPlugin(pluginName):
    """
    Deprecated: use currentBundle()

    Register the current py2app plugin by name and return its bundle
    """
    warnings.warn("Deprecated: use objc.currentBundle()", DeprecationWarning)
    import os
    import sys
    path = os.path.dirname(os.path.dirname(os.environ['RESOURCEPATH']))
    if sys.version_info[0] == 2 and not isinstance(path, unicode):
        path = unicode(path, sys.getfilesystemencoding())
    _PLUGINS[pluginName] = path
    return pluginBundle(pluginName)

def pluginBundle(pluginName):
    """
    Deprecated: use currentBundle()

    Return the main bundle for the named plugin. This should be used
    only after it has been registered with registerPlugin
    """
    warnings.warn("Deprecated: use currentBundle()", DeprecationWarning)
    import objc
    NSBundle = objc.lookUpClass('NSBundle')
    return NSBundle.bundleWithPath_(_PLUGINS[pluginName])

def splitStruct(value):
    warnings.warn("Deprecated: use splitStructSignature()", DeprecationWarning)
    import objc
    return objc.splitStructSignature(value)

def _loadFunctionList(*args, **kwds):
    warnings.warn("Deprecated: use loadFunctionList()", DeprecationWarning)
    import objc
    objc.loadFunctionList(*args, **kwds)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.