On Thu, 3 Nov 2011, Bill Janssen wrote:

Andi Vajda <va...@apache.org> wrote:

Won't specifying "--package javax.imageio" cause all public classes in
that package to be wrapped?  Seems to work that way for java.awt.image.

No, and it never has. All --package blah does is enable dependencies
in that package to be wrapped as well. If you list no classes that
depend on that package then --package blah is a no-op. --package !=
--jar.

From the docs in __main__.py:
    --package PACKAGE       - add PACKAGE to the list of packages from
                              which dependencies are automatically wrapped

If you don't list --package blah and you wrap classes that depend on
other classes in that blah package, then all methods with these
dependencies will be skipped.

Ah, thanks, that explains it.  I am getting ImageIO if I explicitly call
it out.  The reason I'm seeing java.awt.image.BufferedImage is that
GoodStuff explicitly references it.

So, let's test my understanding of what classes are selected to be wrapped:

 * All public classes included with --jar

Yes.

 * All classes from either --include jars or the JRE, which already selected
   classes depend on, that come from packages included with --package

No. If you --include blah.jar and its package(s) are not listed, then classes it contains are not wrapped. The docs say:
    --include JARFILE       - include JARFILE in the distribution and add
                              it to the module's CLASSPATH
--include ensures the classes that depend on it can be loaded (ie, they're put on the classpath and installed into the distribution, not wrapped)
If you want classes in a jar file wrapped, use --jar.

 * All classes from either --include jars or the JRE, which are explicitly
   specified

No. All classes that are explicitely specified, without any restrictions.
You can even for a non-public class to be wrapped by listing it explicitely.

Andi..


Is that right?

Bill


Andi..


Bill


It doesn't look like you asked for the ImageIO class to be wrapped.

Andi..


Everything seems to build just fine, no issues (This is JCC 2.9, Python
2.6, Ubuntu 10.04, amd64, OpenJDK 6).

Then to examine the module, I say,

$ python -c "import goodstuff; goodstuff.initVM(classpath=goodstuff.CLASSPATH); 
print dir(goodstuff)"
['AbstractStringBuilder', 'Appendable', 'Boolean', 'BufferedImage', 'Byte', 
'CLASSPATH', 'CharSequence', 'Character', 'Class', 'ClassLoader', 
'ClassNotFoundException', 'ColorModel', 'Comparable', 
'ConstVariableDescriptor', 'DataBuffer', 'Double', 'Enumeration', 'Exception', 
'FinalizerClass', 'FinalizerProxy', 'Float', 'GoodStuff', 
'IllegalAccessException', 'IllegalArgumentException', 'Image', 'ImageConsumer', 
'ImageObserver', 'ImageProducer', 'IndexColorModel', 'InstantiationException', 
'Integer', 'InterruptedException', 'InvalidArgsError', 'Iterator', 'JArray', 
'JArray_bool', 'JArray_byte', 'JArray_char', 'JArray_double', 'JArray_float', 
'JArray_int', 'JArray_long', 'JArray_object', 'JArray_short', 'JArray_string', 
'JCCEnv', 'JCC_VERSION', 'JObject', 'JavaError', 'Long', 'Number', 
'NumberFormatException', 'Object', 'Package', 'PrintWriter', 'Raster', 
'RenderedImage', 'RuntimeException', 'SampleModel', 'SecurityException', 
'Short', 'StackTraceElement', 'String', 'String
Bu
ffer
', 'StringBuilder', 'StringWriter', 'Throwable', 'TileObserver', 'VERSION', 
'WritableRaster', 'WritableRenderedImage', 'Writer', '__builtins__', '__dir__', 
'__doc__', '__file__', '__name__', '__package__', '__path__', '_goodstuff', 
'findClass', 'getVMEnv', 'initVM', 'os']

There's no ImageIO.

Any ideas?  I see no C++ code generated for the javax package, either:

 /tmp/build/_goodstuff:
 total used in directory 1248 available 11434880
 drwxr-xr-x 3 root root    4096 2011-11-02 09:51 .
 drwxr-xr-x 9 root root    4096 2011-11-02 09:51 ..
 -rw-r--r-- 1 root root   51101 2011-06-28 16:44 functions.cpp
 -rw-r--r-- 1 root root     705 2011-11-02 09:53 goodstuff.cpp
 -rw-r--r-- 1 root root    1147 2011-11-02 09:53 GoodStuff.h
 -rw-r--r-- 1 root root    9441 2011-11-02 09:53 __init__.cpp
 -rw-r--r-- 1 root root   30824 2011-06-28 16:44 JArray.cpp
 drwxr-xr-x 6 root root    4096 2011-11-02 09:53 java
 -rw-r--r-- 1 root root   21968 2011-06-28 16:44 jcc.cpp
 -rw-r--r-- 1 root root   27892 2011-06-28 16:44 JCCEnv.cpp
 -rw-r--r-- 1 root root    6093 2011-06-28 16:44 JObject.cpp
 -rw-r--r-- 1 root root   18386 2011-06-28 16:44 types.cpp
 -rw-r--r-- 1 root root 1076444 2011-11-02 09:53 __wrap__.cpp

Bill


repl: bad addresses:
        pylucene-dev@lucene.apache.org Andi Vajda <va...@apache.org> -- junk 
after local@domain (Andi)

Reply via email to