buildframework/helium/external/python/lib/common/psyco-1.6-py2.5.egg/psyco/__init__.py
author wbernard
Wed, 23 Dec 2009 19:29:07 +0200
changeset 179 d8ac696cc51f
permissions -rw-r--r--
helium_7.0-r14027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     1
###########################################################################
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     2
# 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     3
#  Psyco top-level file of the Psyco package.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     4
#   Copyright (C) 2001-2002  Armin Rigo et.al.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     5
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     6
"""Psyco -- the Python Specializing Compiler.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     7
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     8
Typical usage: add the following lines to your application's main module,
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     9
preferably after the other imports:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    10
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    11
try:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    12
    import psyco
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    13
    psyco.full()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    14
except ImportError:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    15
    print 'Psyco not installed, the program will just run slower'
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    16
"""
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    17
###########################################################################
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    18
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    19
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    20
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    21
# This module is present to make 'psyco' a package and to
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    22
# publish the main functions and variables.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    23
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    24
# More documentation can be found in core.py.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    25
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    26
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    27
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    28
# Try to import the dynamic-loading _psyco and report errors
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    29
try:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    30
    import _psyco
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    31
except ImportError, e:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    32
    extramsg = ''
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    33
    import sys, imp
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    34
    try:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    35
        file, filename, (suffix, mode, type) = imp.find_module('_psyco', __path__)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    36
    except ImportError:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    37
        ext = [suffix for suffix, mode, type in imp.get_suffixes()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    38
               if type == imp.C_EXTENSION]
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    39
        if ext:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    40
            extramsg = (" (cannot locate the compiled extension '_psyco%s' "
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    41
                        "in the package path '%s')" % (ext[0], '; '.join(__path__)))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    42
    else:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    43
        extramsg = (" (check that the compiled extension '%s' is for "
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    44
                    "the correct Python version; this is Python %s)" %
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    45
                    (filename, sys.version.split()[0]))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    46
    raise ImportError, str(e) + extramsg
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    47
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    48
# Publish important data by importing them in the package
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    49
from support import __version__, error, warning, _getrealframe, _getemulframe
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    50
from support import version_info, __version__ as hexversion
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    51
from core import full, profile, background, runonly, stop, cannotcompile
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    52
from core import log, bind, unbind, proxy, unproxy, dumpcodebuf
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    53
from _psyco import setfilter
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    54
from _psyco import compact, compacttype