# HG changeset patch # User Paul Boddie # Date 1100375962 -3600 # Node ID a33f6687721a47c70a2222897f8f0aaa418f0b9e # Parent 6f38e9b8c4a2a3a04b0d9f85a6925cedfa9f63ff Fixed importing from the current directory. Changed the debug messages. Changed module creation. diff -r 6f38e9b8c4a2 -r a33f6687721a classhook.py --- a/classhook.py Sat Nov 13 20:58:36 2004 +0100 +++ b/classhook.py Sat Nov 13 20:59:22 2004 +0100 @@ -29,7 +29,7 @@ from 'dir' and 'name' refers to a directory containing class files. """ - dir = dir or "" + dir = dir or "." # Provide a special name for the current directory. @@ -38,7 +38,7 @@ else: path = os.path.join(dir, name) - print "*", name, dir, path + print "Processing name", name, "in", dir, "producing", path if os.path.isdir(path): if len(glob.glob(os.path.join(path, "*" + os.extsep + "class"))) != 0: return (None, path, ("", "", PKG_DIRECTORY)) @@ -61,13 +61,13 @@ global_names = {} global_names.update(__builtins__.__dict__) - module = new.module(name) + module = self.hooks.add_module(name) # Process each class file, producing a genuine Python class. class_files = [] for class_filename in glob.glob(os.path.join(filename, "*" + os.extsep + "class")): - print "*", class_filename + print "Importing class", class_filename f = open(class_filename, "rb") s = f.read() f.close()