1.1 --- a/micropython/__init__.py Sat Oct 20 01:36:44 2007 +0200
1.2 +++ b/micropython/__init__.py Sun Oct 21 00:53:20 2007 +0200
1.3 @@ -27,6 +27,7 @@
1.4
1.5 importer = Importer(sys.path)
1.6 importer.load_from_file(filename)
1.7 +importer.vacuum()
1.8
1.9 Such importer objects are the most convenient mechanism through which the
1.10 functionality of the micropython package may be accessed.
1.11 @@ -152,10 +153,10 @@
1.12 package exists.
1.13 """
1.14
1.15 + if self.modules.has_key(name) and self.modules[name].loaded:
1.16 + #print "Cached (%s)" % name
1.17 + return self.modules[name]
1.18 print "Loading", name
1.19 - if self.modules.has_key(name) and self.modules[name].loaded:
1.20 - print "Cached", name
1.21 - return self.modules[name]
1.22
1.23 # Split the name into path components, and try to find the uppermost in
1.24 # the search path.
1.25 @@ -163,7 +164,7 @@
1.26 path = name.split(".")
1.27 m = self.find_in_path(path[0])
1.28 if not m:
1.29 - print "Not found", path[0]
1.30 + print "Not found (%s)" % path[0]
1.31 return None # NOTE: Import error.
1.32 d, filename = m
1.33
1.34 @@ -176,7 +177,7 @@
1.35
1.36 if len(path) > 1:
1.37 if not d:
1.38 - print "No package", filename
1.39 + print "No package (%s)" % filename
1.40 return None # NOTE: Import error (package not found).
1.41 else:
1.42 self.add_submodules(d, module)
1.43 @@ -189,7 +190,7 @@
1.44
1.45 m = self.find(d, p)
1.46 if not m:
1.47 - print "Not found", p
1.48 + print "Not found (%s)" % p
1.49 return None # NOTE: Import error.
1.50 d, filename = m
1.51 module_name = ".".join(path_so_far)
1.52 @@ -225,15 +226,15 @@
1.53 module = self.add_module(module_name)
1.54 if not module.loaded and module not in self.loading:
1.55 self.loading.add(module)
1.56 - print "Parsing", name
1.57 + #print "Parsing", name
1.58 module.parse(name)
1.59 - print "Done", name
1.60 + #print "Done", name
1.61 self.loading.remove(module)
1.62 module.loaded = 1
1.63
1.64 # Record the module.
1.65
1.66 - print "Loaded", module_name #, "with namespace", module.namespace.keys()
1.67 + #print "Loaded", module_name, "with namespace", module.namespace.keys()
1.68 return module
1.69
1.70 def add_module(self, module_name):