From: Samuele P. <ped...@bl...> - 2001-11-28 23:07:47
|
[Titus Brown] > -> The answer: don't expect jythonc to cope properly with program-driven > -> changes to sys.path and similar dynamic stuff. > -> > -> jythonc is a *static* tool. > > Ahh, but I have contraindications! In a more complicated piece of code, > dynamic modifications to sys.path result in jythonc finding and correctly > compiling (and including in the output .jar) files from other directories > that were specified only in sys.path. > > So, if no dynamic modifications to sys.path should work for jythonc, then I > don't understand why it *does* work occasionally; and if dynamic modifications > *should* work, then I don't understand why it *isn't* for other projects. > [snip] > But I gather that if there is a bug, it's not a well known one ;). > First I insist: The answer: don't expect jythonc to cope properly with program-driven changes to sys.path and similar dynamic stuff. jythonc is a *static* tool. Then consider: <source/test3.py> </source/test3.py> <test2.py> print "test2 says hi!" import sys sys.path.append('source/') import test3 blackmagic = 1 </test2.py> ***** Nothing happens ** <test1.py> import test2 </test1.py> Let's go: >jythonc --deep -j out.jar test1.py processing test1 processing test2 Required packages: Creating adapters: Creating .java files: test2 module test1 module Compiling .java to .class... Compiling with args: <...> 0 Building archive: out.jar Tracking java dependencies: ***** Blackmagic ** <test1.py> from test2 import blackmagic </test1.py> Let's play sorcerer's apprentice: >jythonc --deep -j out.jar test1.py processing test1 test2 says hi! processing test2 processing test3 Required packages: Creating adapters: Creating .java files: test2 module test3 module test1 module Compiling .java to .class... Compiling with args: <...> 0 Building archive: out.jar Tracking java dependencies: ***** So ** indeed I was able to reproduce what you are reporting. You can report this as a bug, anyway what you describe as things working is just an unwanted side-effect of an hackish implementation that sometimes *do* an import to deal with (some flavor of) import. No, sys.path dynamic modification is not intended to be supported by jythonc. Please don't understimate our understanding of the amount of evil lurking inside jythonc :) That's all folk, Samuele Pedroni. |