|
From: <ti...@ca...> - 2001-06-19 01:07:45
|
Hi all, I have a Jython package that I'd like to distribute in a single file, if possible. I see tantalizing references to "freezing" vs "compiling"; it sounds like I want the former, since I rely fairly heavily on a non-Java file structure (e.g. more than one class/file), but I'm not sure what the options are here. I'd be happy to explore the possibilities if someone can get me started on the right track, but I'd rather not trail-blaze if there's something already out there. I did see a particularly interesting reference to a "shallow freeze" in a 12-2000 post by Finn Bock, but there were no followups. thanks in advance, --titus P.S. It would be quite useful to receive a simple reply like "you'll have to figure it out on your own" so that I know I'm not wasting my time ;). |
|
From: Robert W. B. <rb...@di...> - 2001-06-19 03:16:12
|
Hello Titus,
On Mon, 18 Jun 2001 ti...@ca... wrote:
> Hi all,
>
> I have a Jython package that I'd like to distribute in a single file,
> if possible. I see tantalizing references to "freezing" vs "compiling";
> it sounds like I want the former, since I rely fairly heavily on a
> non-Java file structure (e.g. more than one class/file), but I'm not
> sure what the options are here.
Current options:
1. runnable
2. frozen- seemingly likely option for your needs.
and maybe,
3. Custom import
> I'd be happy to explore the possibilities if someone can get me started
> on the right track, but I'd rather not trail-blaze if there's something
> already out there.
>
> I did see a particularly interesting reference to a "shallow freeze" in
> a 12-2000 post by Finn Bock, but there were no followups.
>
> thanks in advance,
> --titus
>
> P.S. It would be quite useful to receive a simple reply like "you'll have
> to figure it out on your own" so that I know I'm not wasting my time ;).
This isn't really trail-blazing. The jythonc docs are fairly helpful, and
are located at:
http://jython.sourceforge.net/docs/jythonc.html
The cliff-notes are:
Option 1. runnable-
A "runnable" Jython module is one compiled with jythonc without
tracking dependencies. This requires attention to paths to ensure
dependencies are located and loaded (by setting -Dpython.home, or by
explicitly appending to sys.path). If module A imports module B, you make
runnable classes with:
jythonc A.py
Option 2. frozen-
A "frozen" application is one compiled with the --deep option so that
dependancies are tracked. This sounds most useful to your situation
consider you say you are distributing an application (implies that it
doesn't require subsequent changes).
To freeze A.py use:
jythonc --deep -j myapp.jar A.py
This compiles A.py and B.py and places the compiled classes in myapp.jar.
This jar plus jython.jar (plus any other jars you use) is all that is
required to run your app.
You can be increasingly lazy and use the following:
jythonc --all -j myapp.jar A.py
This tracks dependencies and packages up core, parser, and compiler
goodies so everything you need is potentially within this jar (not
including external jars you depend on).
Option 3. Custom import
You'll have to figure it out on your own ;)
Maybe the path at this url helps with option 3:
http://www.jython.org/cgi-bin/moin.cgi/PoorManFreezing
Get back if I've misunderstood the question (again).
-robert
|
|
From: <ti...@ca...> - 2001-06-19 07:13:35
|
-> On Mon, 18 Jun 2001 ti...@ca... wrote: -> > Hi all, -> > -> > I have a Jython package that I'd like to distribute in a single file, -> > if possible. I see tantalizing references to "freezing" vs "compiling"; -> > it sounds like I want the former, since I rely fairly heavily on a -> > non-Java file structure (e.g. more than one class/file), but I'm not -> > sure what the options are here. -> -> Current options: -> 1. runnable -> 2. frozen- seemingly likely option for your needs. Indeed, it was. -> and maybe, -> 3. Custom import ...although I use a bit of this too. -> > I'd be happy to explore the possibilities if someone can get me started -> > on the right track, but I'd rather not trail-blaze if there's something -> > already out there. -> -> This isn't really trail-blazing. The jythonc docs are fairly helpful, and -> are located at: -> -> http://jython.sourceforge.net/docs/jythonc.html I suspected that freezing was the way to go, but the XXXs and complete lack of examples on that page were not so helpful -- in particular, it is only through involved contextual reading that I just realized that "freezing" is clearly stated to be a result of '-j file --deep'... [ munch ] -> To freeze A.py use: -> -> jythonc --deep -j myapp.jar A.py -> -> This compiles A.py and B.py and places the compiled classes in myapp.jar. -> This jar plus jython.jar (plus any other jars you use) is all that is -> required to run your app. [ munch ] Exactly what I needed. The only problem -- and one that may not be addressible w/in Java/Jython -- is that Jython happily imported my file 'ds-chooser.py' whereas Java croaked on classes with a '-' in them. This turned out to be the problem that made the first freeze I tried fail on me. So, my apologies for my confusion, and my thanks for the help! Would anyone be interested in a slight modification of the jythonc.bat documentation elucidating some of these points? cheers, --titus |
|
From: Robert W. B. <rb...@di...> - 2001-06-19 22:14:04
|
Reply appended... On Tue, 19 Jun 2001 ti...@ca... wrote: > -> On Mon, 18 Jun 2001 ti...@ca... wrote: > -> > Hi all, > -> > > -> > I have a Jython package that I'd like to distribute in a single file, > -> > if possible. I see tantalizing references to "freezing" vs "compiling"; > -> > it sounds like I want the former, since I rely fairly heavily on a > -> > non-Java file structure (e.g. more than one class/file), but I'm not > -> > sure what the options are here. > -> > -> Current options: > -> 1. runnable > -> 2. frozen- seemingly likely option for your needs. > > Indeed, it was. > > -> and maybe, > -> 3. Custom import > > ..although I use a bit of this too. > > -> > I'd be happy to explore the possibilities if someone can get me started > -> > on the right track, but I'd rather not trail-blaze if there's something > -> > already out there. > -> > -> This isn't really trail-blazing. The jythonc docs are fairly helpful, and > -> are located at: > -> > -> http://jython.sourceforge.net/docs/jythonc.html > > I suspected that freezing was the way to go, but the XXXs and complete > lack of examples on that page were not so helpful -- in particular, it > is only through involved contextual reading that I just realized that > "freezing" is clearly stated to be a result of '-j file --deep'... > > [ munch ] > > -> To freeze A.py use: > -> > -> jythonc --deep -j myapp.jar A.py > -> > -> This compiles A.py and B.py and places the compiled classes in myapp.jar. > -> This jar plus jython.jar (plus any other jars you use) is all that is > -> required to run your app. > > [ munch ] > > Exactly what I needed. E-x-c-c-cellent. > The only problem -- and one that may not be > addressible w/in Java/Jython -- is that Jython happily imported > my file 'ds-chooser.py' whereas Java croaked on classes with a '-' in > them. This turned out to be the problem that made the first freeze > I tried fail on me. > > So, my apologies for my confusion, and my thanks for the help! Would anyone > be interested in a slight modification of the jythonc.bat documentation > elucidating some of these points? There was a bit of a buzz concerning improving Jython's documentation a while back that inspired a wiki page at: http://www.jython.org/cgi-bin/moin.cgi/JythonDevelDocs Nobody has really contributed there since it was set up, and I've ran into some deadline troubles of my own that have kept me away from it as well. It would be nice to see your suggestion become an addition there, and possibly enliven the place. Otherwise, you could consider revising the language of http://www.jython.org/docs/jythonc.htm and send proposed changes. On another note... I'm curious about what your deliverable is, so I'm guessing others might be as well. Is it something that should be added to: http://jython.sourceforge.net/users.html -robert |
|
From: Robert W. B. <rb...@di...> - 2001-06-19 23:04:57
|
On Tue, 19 Jun 2001, Robert W. Bill wrote: > On another note... > I'm curious about what your deliverable is, so I'm guessing others might > be as well. Is it something that should be added to: > > http://jython.sourceforge.net/users.html Ooops. Nevermind- I see that it already is. I forgot you do "FamilyRelations" and didn't read ahead to your installation note ;) -robert |
|
From: <ti...@ca...> - 2001-07-02 08:37:26
|
[ munch of stuff about improving docs -- more later. ] -> On another note... -> I'm curious about what your deliverable is, so I'm guessing others might -> be as well. Is it something that should be added to: -> -> http://jython.sourceforge.net/users.html As you noted before, it IS there -- FamilyRelations, links through http://family.caltech.edu/ However, you're all welcome to check out the first pre-alpha release, now all nicely tar-red up at http://chabry.caltech.edu/~t/transfer/FR-prealpha-1.tar.gz Aside from idle curiousity, I would be interested in having people check out the distribution situation. Through the CVS, at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/familyjewels/ you can take a look at the Makefile, which is used only for making distributions, and that will give you a clue as to the rest. Essentially, I created a 'startFR.java' file that runs a Python interpreter, which then runs 'start.py' (the development env start file) after initializing the Jython interpreter. This is the shortest & cleanest, although not the least kludgy, way I have found of running things. And, please, let me once more congratulate the Jython developers on an absolutely wonderful product. AMAZING. Writing Java programs is now a blast... cheers, --titus |