From: <no...@so...> - 2002-10-29 15:01:12
|
Patches item #525092, was opened at 2002-03-03 11:25 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=525092&group_id=12867 Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Otmar Humbel (otmarhumbel) >Assigned to: Finn Bock (bckfnn) Summary: disable package scan in registry Initial Comment: The idea of this patch is to allow easy disabling of the package scanning process in situations where it is not wanted, such as: - no write access to the file system - many concurrent users accessing the same jython installation I tried to keep the patch as small as possible (only changing 2 lines in one file, and a new registry entry). Because the flag is only needed in one place, there is no change to Options.java. The registry contains a new entry as follows: # Setting this property to false disables the package scan for the cachedir. # Please be aware that disabling this might break some import statements! python.package.scan = true Changes to PySystemState.java (method initPackages (Properties props)): OLD: 10 private static void initPackages(Properties props) { 20 initCacheDirectory(props); 30 File pkgdir; 40 if (cachedir != null) { 50 pkgdir = new File(cachedir, "packages"); 60 } else { 70 pkgdir = null; 80 } 90 packageManager = new SysPackageManager (pkgdir, props); 100 } NEW (add line 35 and modify line 40): 10 private static void initPackages(Properties props) { 20 initCacheDirectory(props); 30 File pkgdir; *35 boolean packageScan = * props.getProperty ("python.package.scan", "true").equalsIgnoreCase ("true"); *40 if (cachedir != null && packageScan) { 50 pkgdir = new File(cachedir, "packages"); 60 } else { 70 pkgdir = null; 80 } 90 packageManager = new SysPackageManager (pkgdir, props); 100 } ---------------------------------------------------------------------- >Comment By: Finn Bock (bckfnn) Date: 2002-10-29 16:01 Message: Logged In: YES user_id=4201 Added to PySystemState.java: 2.77; The property is called "python.cachedir.skip". The issues for re-enabling import of java-packages for javaos.py must be fixed outside of this patch. ---------------------------------------------------------------------- Comment By: Otmar Humbel (otmarhumbel) Date: 2002-03-05 16:37 Message: Logged In: YES user_id=105844 Sorry but the two files javapath.py and javaos.py use import statements which are not compatible to the suggested patch: This means that without a change to these 2 files, Jython 21 can only be started if the package scan took place. We can fix that in applying the following changes. javapath.py: ------------ replace import java with import sys sys.add_package( "java" ) sys.add_package( "java.io" ) sys.add_package( "java.lang" ) javaos.py: ---------- replace import java from java.io import File, BufferedReader, InputStreamReader, IOException with import sys # move some lines upwards sys.add_package( "java" ) sys.add_package( "java.io" ) sys.add_package( "java.lang" ) from java.io import BufferedReader from java.io import File from java.io import IOException from java.io import InputStreamReader from java.lang import Runtime from java.lang import System and replace all occurrences of 'java.lang.' and 'java.io.' with '' (an empty string) I hope this gives an idea! Best wishes, Oti. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312867&aid=525092&group_id=12867 |