# HG changeset patch # User Paul Boddie # Date 1336682984 -7200 # Node ID aecd140f6642e759e4d68cdad2a89c72c1baf54c # Parent 8a8924a29cf8c3237112011feb4bb60548e26046 Changed the builtins module loading to use the module search path. This makes it easier to run the test program from another location. Added a note about relative imports. diff -r 8a8924a29cf8 -r aecd140f6642 TO_DO.txt --- a/TO_DO.txt Tue May 08 00:29:20 2012 +0200 +++ b/TO_DO.txt Thu May 10 22:49:44 2012 +0200 @@ -207,6 +207,11 @@ Support __init__ traversal (and other implicit names) more effectively. +Importing Modules +================= + +Consider supporting relative imports, even though this is arguably a misfeature. + Other ===== diff -r 8a8924a29cf8 -r aecd140f6642 micropython/cmd.py --- a/micropython/cmd.py Tue May 08 00:29:20 2012 +0200 +++ b/micropython/cmd.py Thu May 10 22:49:44 2012 +0200 @@ -20,6 +20,7 @@ this program. If not, see . """ +from os.path import exists, join import micropython def parse_optimisations(args): @@ -53,7 +54,11 @@ i = micropython.Importer(path, verbose, requested_optimisations) p = micropython.Program(i, requested_optimisations) - i.load_from_file("lib/builtins.py", "__builtins__") + for d in path: + builtins = join(d, "builtins.py") + if exists(builtins): + i.load_from_file(builtins, "__builtins__") + break return p # Convenience functions.