? ant.properties ? build Index: org/python/core/imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.59 diff -u -r2.59 imp.java --- org/python/core/imp.java 21 Dec 2001 00:20:17 -0000 2.59 +++ org/python/core/imp.java 14 Jul 2004 18:51:18 -0000 @@ -244,15 +244,19 @@ if (Py.frozenPackage != null) { modName = Py.frozenPackage+"."+modName; } - return Py.findClassEx(modName+"$_PyInner", "precompiled"); + Class c = Py.findClassEx(modName+"$_PyInner", "precompiled"); + if (c == null) { + c = Py.findClassEx(modName + "$py", "preloaded"); + } + return c; } private static PyObject loadPrecompiled(String name, String modName, PyList path) { + Class c = null; if (Py.frozenModules != null) { //System.out.println("precomp: "+name+", "+modName); - Class c; if (Py.frozenModules.get(modName+".__init__") != null) { //System.err.println("trying: "+modName+".__init__$_PyInner"); @@ -265,17 +269,16 @@ PyModule m = addModule(modName); m.__dict__.__setitem__("__path__", new PyList()); } - else if (Py.frozenModules.get(modName) != null) { + } + if (c == null) { c = findPyClass(modName); if (c == null) return null; Py.writeComment("import", "'" + modName + "' as " + "precompiled module"); - } - else return null; - - //System.err.println("creating: "+modName+", "+c); + } + if (c != null) { return createFromClass(modName, c); - } + } return null; } @@ -309,14 +312,14 @@ ZipEntry pyEntry = zipArchive.getEntry(pyName); ZipEntry classEntry = zipArchive.getEntry(className); - if (pyEntry != null) { + if (pyEntry != null || classEntry != null) { Py.writeDebug("import", "trying source entry: " + pyName + " from jar/zip file " + zipArchive); if (classEntry != null) { Py.writeDebug("import", "trying precompiled entry " + className + " from jar/zip file " + zipArchive); - long pyTime = pyEntry.getTime(); + long pyTime = pyEntry == null ? 0 : pyEntry.getTime(); long classTime = classEntry.getTime(); if (classTime >= pyTime) { InputStream is = @@ -328,8 +331,11 @@ } } } - InputStream is = zipArchive.getInputStream(pyEntry); - return createFromSource(modName, is, pyEntry.getName(), null); + if (pyEntry != null) { + InputStream is = zipArchive.getInputStream(pyEntry); + return createFromSource(modName, is, pyEntry.getName(), + null); + } } } catch (Exception e) { Py.writeDebug("import", "loadFromZipFile exception: " +