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