OK, well it looks like the easiest solution
fo rme might be to simply pre-compile the system modules. I found
the "compileall.py" script in the Lib folder, and it does exactly
what I want. I just have one question... Should this be run
with the same JRE that my product ships with, or does it matter? I
develop with 1.5, but I ship with 1.4.2_07. Can I compile the modules
and check them into CVS, or should I do it as part of my build process,
or even as part of the installer?
I am packaging Jython as part of a plugin
that is installed with a product. Currently, I have the /Lib
folder filled with system modules (.py files) located in my plugin as well,
and my plugin location is set as my "python.home" location, so
it finds everything just fine. The problem is, when I import a system
module, Jython compiles it to a $py.class file in that folder, and this
rapidly creates a lot of junk in my plugin directory, but not only that
- when the user does not have write access to this folder - I assume something
bad will happen??
What I am wondering is:
- Is there any way to tell Jython to create
the $py.class files in a certain folder (ideally I'd like them to go in
the cachedir, but that doesn't appear to be possible)?
- What *will* happen if Jython can't write
the $py.class file?
- I tried zipping everything up and appending
the zipfile to sys.path - which seems to work - but it looks like it doesn't
create the $py.class file anywhere in this case. I assume it is just
compiling it to memory every time it is imported, and not caching it at
all? I guess this is what will happen if it can't write the $py.class
- If I can't tell Jython to place these
$py.class files anywhere, is there any *easy* way to pre-compile the entire
system library (meaning all of the .py files in the /Lib folder)?
Thanks for your help,