From: Finn B. <bc...@us...> - 2001-12-06 14:31:15
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv6411 Modified Files: PackageManager.java PySystemState.java SysPackageManager.java SyspathArchive.java Log Message: Added a boolean to PackageManager.addJar() and PackageManager.addJarDir() that controls if the created package index should be saved in cachedir. Added a similar optional boolean to sys.add_extdir(). Index: PackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PackageManager.java,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** PackageManager.java 2001/11/27 13:51:37 2.11 --- PackageManager.java 2001/12/06 14:31:12 2.12 *************** *** 57,61 **** * @param dir A directory name. */ ! public abstract void addJarDir(String dir); /** --- 57,61 ---- * @param dir A directory name. */ ! public abstract void addJarDir(String dir, boolean cache); /** *************** *** 65,69 **** * @param jarfile A directory name. */ ! public abstract void addJar(String jarfile); /** Basic helper implementation of {@link #doDir}. --- 65,69 ---- * @param jarfile A directory name. */ ! public abstract void addJar(String jarfile, boolean cache); /** Basic helper implementation of {@link #doDir}. Index: PySystemState.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PySystemState.java,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** PySystemState.java 2001/11/28 19:25:33 2.69 --- PySystemState.java 2001/12/06 14:31:12 2.70 *************** *** 566,571 **** /** * Add a .jar & .zip directory to the list of places that are searched ! * for java .jar and .zip files. The .jar and .zip files found will be ! * cached * <p> * <b>Note</b>. Classes in .jar and .zip files found in the directory --- 566,571 ---- /** * Add a .jar & .zip directory to the list of places that are searched ! * for java .jar and .zip files. The .jar and .zip files found will not ! * be cached. * <p> * <b>Note</b>. Classes in .jar and .zip files found in the directory *************** *** 573,580 **** * add_classdir(dir) for more details. * * @see #add_classdir */ public static void add_extdir(String directoryPath) { ! packageManager.addJarDir(directoryPath); } --- 573,600 ---- * add_classdir(dir) for more details. * + * @param directoryPath The name of a directory. + * * @see #add_classdir */ public static void add_extdir(String directoryPath) { ! packageManager.addJarDir(directoryPath, false); ! } ! ! /** ! * Add a .jar & .zip directory to the list of places that are searched ! * for java .jar and .zip files. ! * <p> ! * <b>Note</b>. Classes in .jar and .zip files found in the directory ! * are not made available to jython by this call. See the note for ! * add_classdir(dir) for more details. ! * ! * @param directoryPath The name of a directory. ! * @param cache Controls if the packages in the zip and jar ! * file should be cached. ! * ! * @see #add_classdir ! */ ! public static void add_extdir(String directoryPath, boolean cache) { ! packageManager.addJarDir(directoryPath, cache); } Index: SysPackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/SysPackageManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SysPackageManager.java 2001/12/04 10:24:34 1.10 --- SysPackageManager.java 2001/12/06 14:31:12 1.11 *************** *** 37,49 **** } ! public void addJar(String jarfile) { ! addJarToPackages(new File(jarfile), false); } ! public void addJarDir(String jdir) { ! addJarDir(jdir, true); } ! public void addJarDir(String jdir, boolean save) { File file = new File(jdir); if (!file.isDirectory()) return; --- 37,51 ---- } ! public void addJar(String jarfile, boolean cache) { ! addJarToPackages(new File(jarfile), cache); ! if (cache) ! saveCache(); } ! public void addJarDir(String jdir, boolean cache) { ! addJarDir(jdir, cache, cache); } ! private void addJarDir(String jdir, boolean cache, boolean saveCache) { File file = new File(jdir); if (!file.isDirectory()) return; *************** *** 52,59 **** String entry = files[i]; if (entry.endsWith(".jar") || entry.endsWith(".zip")) { ! addJarToPackages(new File(jdir,entry),true); } } ! if (save) saveCache(); } --- 54,61 ---- String entry = files[i]; if (entry.endsWith(".jar") || entry.endsWith(".zip")) { ! addJarToPackages(new File(jdir,entry), cache); } } ! if (saveCache) saveCache(); } *************** *** 65,69 **** // ??pending: do jvms trim? how is interpreted entry=""? String entry = tok.nextToken(); ! addJarDir(entry, false); } } --- 67,71 ---- // ??pending: do jvms trim? how is interpreted entry=""? String entry = tok.nextToken(); ! addJarDir(entry, true, false); } } Index: SyspathArchive.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/SyspathArchive.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SyspathArchive.java 2001/11/27 13:51:37 1.3 --- SyspathArchive.java 2001/12/06 14:31:12 1.4 *************** *** 11,15 **** archiveName = getArchiveName(archiveName); zipFile = new ZipFile(new File(archiveName)); ! Py.getSystemState().packageManager.addJar(archiveName); } --- 11,15 ---- archiveName = getArchiveName(archiveName); zipFile = new ZipFile(new File(archiveName)); ! Py.getSystemState().packageManager.addJar(archiveName, false); } |