On Fri, Sep 4, 2009 at 08:44, Charlie Groves<charlie.groves@...> wrote:
> On Wed, Sep 2, 2009 at 10:21 AM, Thomas
> Mortagne<thomas.mortagne@...> wrote:
>> i was kind of hoping that Jython would scan all jars in the classpath
>> to find the .py files automatically but it seems i did not found the
>> right thing to enable or configure.
> That should be enabled by default. As of 2.5.0, Jython adds
> __pyclasspath__/ to sys.path, and that serves as a PEP 302 import hook
> to tell it to look for .py and $py.class files on the classpath. As
> long as you have a jar containing those .py files in its root on the
> classpath, Jython should load them. If that isn't the case, filing a
> bug at bugs.jython.org would be appreciated.
Ok for simple standalone .py files but something like Pygments has sub modules
And i can't put all the .py files in the root since each folder
contains a __init__.py files (sorry for maybe dumb questions I'm
really not a Python expert).
>> The best would be to compile
>> Pygments in .class in a clean jar I guess but i could not find if
>> there was already a way to use the coming compiler ("clamp" if i
>> remember well).
> As long as it's pure Python code like Pygments, nothing beyond
> standard Jython is necessary. clamp makes it to where Python classes
> can be called directly by Java, which isn't necessary for this.
> For compiling python modules, look at the compileall.py module in Lib.
> It can be invoked by Jython as a script, and it compiles a whole
> directory tree of Python files. You can then jar up the resulting
> $py.class, and the same __pyclasspath__ hook will handle importing
Ok great, exactly what i was searching for :)
But again what about the sub folders ?