diff options
author | Armin Rigo <arigo@tunes.org> | 2013-05-20 13:52:25 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2013-05-20 13:52:25 +0200 |
commit | c35ea16e63ff7037cd5140a4cd7037b428676134 (patch) | |
tree | 9e903c6a168858a2ff5c25169ba09f5e0327aac5 /cffi/vengine_gen.py | |
parent | 4e35bd9ed343a65a13294700fb610198c8e1001a (diff) | |
download | cffi-c35ea16e63ff7037cd5140a4cd7037b428676134.tar.gz |
Fix (motivated by a pypy without cpyext): if we're using vengine_gen.py,
then we should not use imp.find_module() to locate our compiled module,
because it's actually not a CPython C API module at all. Instead, just
walk sys.path in that case.
Diffstat (limited to 'cffi/vengine_gen.py')
-rw-r--r-- | cffi/vengine_gen.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cffi/vengine_gen.py b/cffi/vengine_gen.py index c3d8a83..cbcdc88 100644 --- a/cffi/vengine_gen.py +++ b/cffi/vengine_gen.py @@ -1,4 +1,4 @@ -import sys +import sys, os import types from . import model, ffiplatform @@ -20,6 +20,16 @@ class VGenericEngine(object): # up in kwds['export_symbols']. kwds.setdefault('export_symbols', self.export_symbols) + def find_module(self, module_name, path, so_suffix): + basename = module_name + so_suffix + if path is None: + path = sys.path + for dirname in path: + filename = os.path.join(dirname, basename) + if os.path.isfile(filename): + return filename + return None + def collect_types(self): pass # not needed in the generic engine |