home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 June / CHIP 2006-06.2.iso / program / freeware / Democracy-0.8.2.exe / xulrunner / python / psyco / __init__.py next >
Encoding:
Python Source  |  2005-06-04  |  1.9 KB  |  58 lines

  1. ###########################################################################
  2. #  Psyco top-level file of the Psyco package.
  3. #   Copyright (C) 2001-2002  Armin Rigo et.al.
  4.  
  5. """Psyco -- the Python Specializing Compiler.
  6.  
  7. Typical usage: add the following lines to your application's main module:
  8.  
  9. try:
  10.     import psyco
  11.     psyco.profile()
  12. except:
  13.     print 'Psyco not found, ignoring it'
  14. """
  15. ###########################################################################
  16.  
  17.  
  18. #
  19. # This module is present to make 'psyco' a package and to
  20. # publish the main functions and variables.
  21. #
  22. # More documentation can be found in core.py.
  23. #
  24.  
  25.  
  26. # Try to import the dynamic-loading _psyco and report errors
  27. try:
  28.     import _psyco
  29. except ImportError, e:
  30.     extramsg = ''
  31.     import sys, imp
  32.     try:
  33.         file, filename, (suffix, mode, type) = imp.find_module('_psyco', __path__)
  34.     except ImportError:
  35.         ext = [suffix for suffix, mode, type in imp.get_suffixes()
  36.                if type == imp.C_EXTENSION]
  37.         if ext:
  38.             extramsg = (" (cannot locate the compiled extension '_psyco%s' "
  39.                         "in the package path '%s')" % (ext[0], '; '.join(__path__)))
  40.     else:
  41.         extramsg = (" (check that the compiled extension '%s' is for "
  42.                     "the correct Python version; this is Python %s)" %
  43.                     (filename, sys.version.split()[0]))
  44.     raise ImportError, str(e) + extramsg
  45.  
  46. # Publish important data by importing them in the package
  47. from support import __version__, error, warning, _getrealframe, _getemulframe
  48. from support import version_info, __version__ as hexversion
  49. from core import full, profile, background, runonly, stop, cannotcompile
  50. from core import log, bind, unbind, proxy, unproxy, dumpcodebuf
  51. from _psyco import setfilter
  52.  
  53. try:
  54.     from _psyco import compact, compacttype    # Python 2.2 and above only
  55. except ImportError:
  56.     pass
  57.