1__all__ = ['runtime', 'pluginBundle', 'registerPlugin'] 2 3class Runtime: 4 """ 5 Backward compatibility interface. 6 7 This class provides (partial) support for the interface of 8 older versions of PyObjC. 9 """ 10 def __getattr__(self, name): 11 import warnings 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 import os 41 import sys 42 path = os.path.dirname(os.path.dirname(os.environ['RESOURCEPATH'])) 43 if not isinstance(path, unicode): 44 path = unicode(path, sys.getfilesystemencoding()) 45 _PLUGINS[pluginName] = path 46 return pluginBundle(pluginName) 47 48def pluginBundle(pluginName): 49 """ 50 Deprecated: use currentBundle() 51 52 Return the main bundle for the named plugin. This should be used 53 only after it has been registered with registerPlugin 54 """ 55 import warnings 56 warnings.warn("Deprecated: use currentBundle()", DeprecationWarning) 57 from Foundation import NSBundle 58 return NSBundle.bundleWithPath_(_PLUGINS[pluginName]) 59