author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Fri, 24 Apr 2009 14:16:00 +0000 | |
changeset 2273 | e4cb9c53db3e |
parent 1278 | a7766286a7be |
permissions | -rwxr-xr-x |
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
# |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2007 Google Inc. |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
# |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
# |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
# |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
# |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
17 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
18 |
"""Stub replacement for Python's imp module.""" |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
20 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
21 |
import os |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
import sys |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
PY_SOURCE, PY_COMPILED, C_EXTENSION = 1, 2, 3 |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
PKG_DIRECTORY, C_BUILTIN, PY_FROZEN = 5, 6, 7 |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
27 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
def get_magic(): |
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
30 |
"""Return the magic string used to recognize byte-compiled code files.""" |
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
31 |
return '\0\0\0\0' |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
33 |
|
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
34 |
_PY_SOURCE_SUFFIX = ('.py', 'U', PY_SOURCE) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
35 |
_PKG_DIRECTORY_SUFFIX = ('', '', PKG_DIRECTORY) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
36 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
37 |
|
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
38 |
def get_suffixes(): |
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
39 |
"""Return a list that describes the files that find_module() looks for.""" |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
40 |
return [_PY_SOURCE_SUFFIX] |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
41 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
42 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
43 |
def find_module(name, path=None): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
44 |
"""Try to find the named module on the given search path or sys.path.""" |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
45 |
if path == None: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
46 |
path = sys.path |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
47 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
48 |
for directory in path: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
49 |
filename = os.path.join(directory, '%s.py' % name) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
50 |
if os.path.exists(filename): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
51 |
return open(filename, 'U'), filename, _PY_SOURCE_SUFFIX |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
52 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
53 |
dirname = os.path.join(directory, name) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
54 |
filename = os.path.join(dirname, '__init__.py') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
55 |
if os.path.exists(filename): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
56 |
return None, dirname, _PKG_DIRECTORY_SUFFIX |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
57 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
58 |
raise ImportError('No module named %s' % name) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
59 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
60 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
61 |
def load_module(name, file_, pathname, description): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
62 |
"""Load or reload the specified module. |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
63 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
64 |
Please note that this function has only rudimentary supported on App Engine: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
65 |
Only loading packages is supported. |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
66 |
""" |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
67 |
suffix, mode, type_ = description |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
68 |
if type_ == PKG_DIRECTORY: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
69 |
if name in sys.modules: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
70 |
mod = sys.modules[name] |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
71 |
else: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
72 |
mod = new_module(name) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
73 |
sys.modules[name] = mod |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
74 |
filename = os.path.join(pathname, '__init__.py') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
75 |
mod.__file__ = filename |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
76 |
execfile(filename, mod.__dict__, mod.__dict__) |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
77 |
return mod |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
78 |
else: |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
79 |
raise NotImplementedError('Only importing packages is supported on ' |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
80 |
'App Engine') |
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
81 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
82 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
83 |
def new_module(name): |
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
84 |
"""Return a new empty module object.""" |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
85 |
return type(sys)(name) |
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
86 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
87 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
88 |
def lock_held(): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
89 |
"""Return False since threading is not supported.""" |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
90 |
return False |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
91 |
|
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
92 |
|
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
93 |
def acquire_lock(): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
94 |
"""Acquiring the lock is a no-op since no threading is supported.""" |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
95 |
pass |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
96 |
|
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
97 |
|
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
98 |
def release_lock(): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
99 |
"""There is no lock to release since acquiring is a no-op when there is no |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
100 |
threading.""" |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
101 |
pass |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
102 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
103 |
|
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
104 |
def init_builtin(name): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
105 |
raise NotImplementedError('This function is not supported on App Engine.') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
106 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
107 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
108 |
def init_frozen(name): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
109 |
raise NotImplementedError('This function is not supported on App Engine.') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
110 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
111 |
|
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
112 |
def is_builtin(name): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
113 |
return name in sys.builtin_module_names |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
114 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
115 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
116 |
def is_frozen(name): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
117 |
return False |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
118 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
119 |
|
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
120 |
def load_compiled(name, pathname, file_=None): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
121 |
raise NotImplementedError('This function is not supported on App Engine.') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
122 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
123 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
124 |
def load_dynamic(name, pathname, file_=None): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
125 |
raise NotImplementedError('This function is not supported on App Engine.') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
126 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
127 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
128 |
def load_source(name, pathname, file_=None): |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
129 |
raise NotImplementedError('This function is not supported on App Engine.') |
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
130 |
|
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
131 |
|
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
132 |
class NullImporter(object): |
2273
e4cb9c53db3e
Load /Users/solydzajs/Desktop/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1278
diff
changeset
|
133 |
"""Null importer object""" |
1278
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
134 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
135 |
def __init__(self, path_string): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
136 |
if not path_string: |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
137 |
raise ImportError("empty pathname") |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
138 |
elif os.path.isdir(path_string): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
139 |
raise ImportError("existing directory") |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
140 |
|
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
141 |
def find_module(self, fullname): |
a7766286a7be
Load /Users/solydzajs/Downloads/google_appengine into
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
142 |
return None |