# HG changeset patch # User Paul Boddie # Date 1219359059 -7200 # Node ID 93404fc56e5df4bc725f841a8294b954d0bca4ae # Parent 5054b2ba3f9c465250d411dc0ee9b567d89f2caa Added an ordered list of modules whose code can then be executed in order, thus preserving the behaviour of compiled programs. diff -r 5054b2ba3f9c -r 93404fc56e5d micropython/__init__.py --- a/micropython/__init__.py Thu Aug 21 00:49:15 2008 +0200 +++ b/micropython/__init__.py Fri Aug 22 00:50:59 2008 +0200 @@ -65,6 +65,7 @@ self.path = path or [os.getcwd()] self.verbose = verbose self.modules = {} + self.modules_ordered = [] self.loading = set() # Remember the tables once generated. @@ -124,8 +125,9 @@ const.location = pos image.append(const) - for module_name, module in self.modules.items(): - if not with_builtins and module_name == "__builtins__": + for module in self.modules_ordered: + + if not with_builtins and module.name == "__builtins__": continue # Fix the attributes. @@ -475,6 +477,7 @@ if not self.modules.has_key(module_name): self.modules[module_name] = module = micropython.inspect.InspectedModule(module_name, self) + self.modules_ordered.append(module) else: module = self.modules[module_name] return module