Hi Helmut,

On Sat, 27 Apr 2013, Helmut Jarausch wrote:

Hi,
after a long time I'm in need to reinstall pylucene on my Gentoo system.
Here, Lucene-3.5.0, oracle-jdk-bin-1.7.0.21 and Python-2.7.4 is installed.

I fetched the pylucene_3_5 branch of svn.apache.org/repos/asf/lucene/pylucene/
Patching setuptools and installing jcc did work.

But trying to build pylucene itself fails with:

Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
  "__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
  exec code in run_globals
File "/usr/lib64/python2.7/site-packages/JCC-2.16-py2.7-linux-x86_64.egg/jcc/__main__.py", line 107, in <module>
  cpp.jcc(sys.argv)
File "/usr/lib64/python2.7/site-packages/JCC-2.16-py2.7-linux-x86_64.egg/jcc/cpp.py", line 655, in jcc raise ValueError, (cls, 'python class name already in use, use --rename', name, pythonNames[name]) ValueError: (<Class: class org.apache.lucene.analysis.nl.DutchStemmer>, 'python class name already in use, use --rename', u'DutchStemmer', <Class: class org.tartarus.snowball.ext.DutchStemmer>)


In addition there were some warnings:

Warning: renaming static method 'toString' on class java.lang.Byte to 'toString_' since it is shadowed by non-static method of same name. Warning: renaming static method 'getCurrentSegmentFileName' on class org.apache.lucene.index.SegmentInfos to 'getCurrentSegmentFileName_' since it is shadowed by non-static method of same name. Warning: renaming static method 'toString' on class java.lang.Boolean to 'toString_' since it is shadowed by non-static method of same name. Warning: renaming static method 'foldToASCII' on class org.apache.lucene.analysis.ASCIIFoldingFilter to 'foldToASCII_' since it is shadowed by non-static method of same name. Warning: renaming static method 'copy' on class org.apache.lucene.store.Directory to 'copy_' since it is shadowed by non-static method of same name. Warning: renaming static method 'toString' on class java.lang.Long to 'toString_' since it is shadowed by non-static method of same name.

What am I missing?

The answer is in the error message:

  ValueError: (<Class: class org.apache.lucene.analysis.nl.DutchStemmer>,
  'python class name already in use, use --rename', u'DutchStemmer', <Class:
  class org.tartarus.snowball.ext.DutchStemmer>)

There are two classes named DutchStemmer and one must be wrapped with a renamed Python wrapper so as to not clash with the other. There several other cases of this in the PyLucene Makefile and you should use them as
examples:
  --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer

Pick another name for the second DutchStemmer Python wrapper class (as in the example above and add this as a --rename line to the other ones in the Makefile.

This situation is fixed in the upcoming PyLucene 4.3 release where JCC
emits a complete package hierarchy and classes stay in their namespaces, no longer clashing.

As to the other warnings, they are just warnings. They matter if you want to call these methods.

Andi..



Many thanks for a hint,
Helmut.

Reply via email to