You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Bill Janssen <ja...@parc.com> on 2011/11/02 18:02:12 UTC

can't export ImageIO?

I'm trying to export the javax.imageio.ImageIO class from a Python
module.  I use the following command:

$ sudo python -m jcc.__main__ --jar GoodStuff.jar --package java.awt.image --package javax.imageio --python goodstuff --version 1.0.0 --vmarg -Djava.awt.headless=true --build --install

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', 'StringBuffer
 ', '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

Re: can't export ImageIO?

Posted by Andi Vajda <va...@apache.org>.
On Thu, 3 Nov 2011, Bill Janssen wrote:

> Andi Vajda <va...@apache.org> wrote:
>
>>
>> On Thu, 3 Nov 2011, Bill Janssen wrote:
>>
>>>>>  * 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.
>>>
>>> Yes, that was implied by what I meant to say.  But if the --include jar
>>> file's packages are listed, they will be wrapped.  Is that right?
>>
>> No. The only classes that get wrapped are:
>>   - the ones listed explicitely
>>   - the public ones in --jar files
>>   - the ones needed by listed or --jar'ed ones whose packages are listed by
>>     --package flags
>
> Right.  I put it wrongly again.
>
> When you say
>
>>   - the ones needed by listed or --jar'ed ones whose packages are listed by
>>     --package flags
>
> does that include ones that are only found in --include jar files,
> because the classes in those jar files are after all part of the
> classpath?

No. The only point of --include over --classpath is to have these jar files
into the egg being built.

Andi..

Re: can't export ImageIO?

Posted by Bill Janssen <ja...@parc.com>.
Andi Vajda <va...@apache.org> wrote:

> 
> On Thu, 3 Nov 2011, Bill Janssen wrote:
> 
> >>>  * 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.
> >
> > Yes, that was implied by what I meant to say.  But if the --include jar
> > file's packages are listed, they will be wrapped.  Is that right?
> 
> No. The only classes that get wrapped are:
>   - the ones listed explicitely
>   - the public ones in --jar files
>   - the ones needed by listed or --jar'ed ones whose packages are listed by
>     --package flags

Right.  I put it wrongly again.

When you say

>   - the ones needed by listed or --jar'ed ones whose packages are listed by
>     --package flags

does that include ones that are only found in --include jar files,
because the classes in those jar files are after all part of the
classpath?

Bill

Re: can't export ImageIO?

Posted by Andi Vajda <va...@apache.org>.
On Thu, 3 Nov 2011, Bill Janssen wrote:

>>>  * 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.
>
> Yes, that was implied by what I meant to say.  But if the --include jar
> file's packages are listed, they will be wrapped.  Is that right?

No. The only classes that get wrapped are:
   - the ones listed explicitely
   - the public ones in --jar files
   - the ones needed by listed or --jar'ed ones whose packages are listed by
     --package flags

--include has no effect on this, it's there only so that these jar files get 
installed into the egg and put on the classpath for you.

Andi..

Re: can't export ImageIO?

Posted by Bill Janssen <ja...@parc.com>.
Andi Vajda <va...@apache.org> wrote:

> 
> 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.

Yes, that was implied by what I meant to say.  But if the --include jar
file's packages are listed, they will be wrapped.  Is that right?

Perhaps a better way of putting it would be:

   * Any classes which otherwise selected classes depend on, *and*
     come from a package specified with --package.

> 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.

So, it should say,

   * All classes, public or private, from any source (the JRE, --jar jar
     files, or --include jar files, which are the only possible sources)
     which are explicitly specified.

Bill

> 
> 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', 'Stri
 ng
> > 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)
> >

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

Re: can't export ImageIO?

Posted by Andi Vajda <va...@apache.org>.
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)
>

Re: can't export ImageIO?

Posted by Bill Janssen <ja...@parc.com>.
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
  * All classes from either --include jars or the JRE, which already selected
    classes depend on, that come from packages included with --package
  * All classes from either --include jars or the JRE, which are explicitly
    specified

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)

Re: can't export ImageIO?

Posted by Andi Vajda <va...@apache.org>.
On Thu, 3 Nov 2011, Bill Janssen wrote:

> Andi Vajda <va...@apache.org> wrote:
>
>>
>> On Nov 2, 2011, at 10:02, Bill Janssen <ja...@parc.com> wrote:
>>
>>> I'm trying to export the javax.imageio.ImageIO class from a Python
>>> module.  I use the following command:
>>>
>>> $ sudo python -m jcc.__main__ --jar GoodStuff.jar --package java.awt.image --package javax.imageio --python goodstuff --version 1.0.0 --vmarg -Djava.awt.headless=true --build --install
>
> 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.

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', 'StringBu
> 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
>

Re: can't export ImageIO?

Posted by Bill Janssen <ja...@parc.com>.
Andi Vajda <va...@apache.org> wrote:

> 
> On Nov 2, 2011, at 10:02, Bill Janssen <ja...@parc.com> wrote:
> 
> > I'm trying to export the javax.imageio.ImageIO class from a Python
> > module.  I use the following command:
> > 
> > $ sudo python -m jcc.__main__ --jar GoodStuff.jar --package java.awt.image --package javax.imageio --python goodstuff --version 1.0.0 --vmarg -Djava.awt.headless=true --build --install

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.

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', 'StringBu
 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

Re: can't export ImageIO?

Posted by Andi Vajda <va...@apache.org>.
On Nov 2, 2011, at 10:02, Bill Janssen <ja...@parc.com> wrote:

> I'm trying to export the javax.imageio.ImageIO class from a Python
> module.  I use the following command:
> 
> $ sudo python -m jcc.__main__ --jar GoodStuff.jar --package java.awt.image --package javax.imageio --python goodstuff --version 1.0.0 --vmarg -Djava.awt.headless=true --build --install

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', 'StringBuffer
> ', '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