import imp
import sys
import strop
-import __builtin__ ### why this instead of just using __builtins__ ??
+import __builtin__
# for the DirectoryImporter
import struct
######################################################################
#
-# Emulate the standard sys.path import mechanism
+# Emulate the standard path-style import mechanism
#
-class SysPathImporter(Importer):
- def __init__(self):
+class PathImporter(Importer):
+ def __init__(self, path=sys.path):
+ self.path = path
# we're definitely going to be importing something in the future,
# so let's just load the OS-related facilities.
return _fs_import(parent.__pkgdir__, modname)
# scan sys.path, looking for the requested module
- for dir in sys.path:
+ for dir in self.path:
result = _fs_import(dir, modname)
if result:
return result
def _test_revamp():
"Debug/test function for the revamped import system."
BuiltinImporter().install()
- SysPathImporter().install()
+ PathImporter().install()
def _print_importers():
items = sys.modules.items()