|
From: Samuele P. <pe...@in...> - 2001-04-13 19:24:58
|
Hi. (I'm not vanished) [Finn] > [Danney Jarman] > > >Previously I had sent the following; however, since I did not get any > >response, here it is again. > > The first time there wasn't any code included. > > >I have been programming in Java only a few days, and one of my first > >projects was to work on the ability to integrate Jython into > >InstallShield. > >Though there were many possible solutions, I wanted to have > >the ability for Jython to import .py modules from jar and zip > >files. > > We all agree that this feature is very usefull. > > >I wrote the method loadFromZipFile into the imp.java file > >to resolve the problem. I realize it is quite crude; however, My hope is > >that a REAL Java programmer will run with it to add this capability > >to a build. I have found this capability a great deal of help in my > >attempts to create a number of Jython deployment solutions. > > There are some problems with your code. > > 1) The .zip file(s) is opened and closed for each module that is > searched through sys.path. That will make .py and $py.class from .zip > very much slower than from directories. I believe that java programmers > will expect .zip files to be just as fast as directories. They will have > this expectation based on their experience with CLASSPATH envvar. That > will mean that the .zip files have to be kept open and that we must > track changes to sys.path and close the zip file only when it is removed > from sys.path. > (I was thinking about this in order to start to code something after finishing the nested scopes stuff) The problem is more serious, because one can put a jar in sys.path, import a python package then remove the jar but in theory one should be able to futher import modules from the package, tracking sys.path is not enough ... any ideas? In principle if a package gets mported from a jar we should not close the jar directly but rely on gc, or use finalization ... Old question: better to use a wrapped list for sys.path (=> some oddities) or enable to put observers on every list (overkill?) ? PS: unrelated, for the curious: jrgp.sourceforge.net |