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

> 
> On Wed, 7 Dec 2011, Bill Janssen wrote:
> 
> > This part of the PyLucene Makefile is still screwed up:
> >
> > # Mac OS X 10.5 (32-bit Python 2.5, Java 1.5)
> > #PREFIX_PYTHON=/usr
> > #ANT=ant
> > #PYTHON=$(PREFIX_PYTHON)/bin/python
> > #JCC=$(PYTHON) -m jcc --shared
> > #NUM_FILES=4
> >
> > The way that jcc/__init__.py is now written, there's no way to invoke it
> > with "-m jcc", even on Python versions where that's supposed to work.
> > The last line, "_jcc.CLASSPATH = CLASSPATH" will always fail, because "_jcc"
> > isn't imported anywhere.
> 
> I'm a bit confused about how this can or cannot work.
> For whatever it's worth, with Python 2.7, running with -m jcc works
> fine here.
> 
> That being said, I don't see how this statement:
>  _jcc.CLASSPATH = CLASSPATH
> 
> can work at all since there is nothing visibly importing _jcc.
> Something puts it there, though, because it works.
> 
> Can you shed some light on this ?
> 
> ... debugging a bit further ... via pdb ...
> 
> Apparently, the statement:
>    from _jcc import initVM
> 
> causes the _jcc symbol to appear.

That seems broken.  Certainly shouldn't work that way.

> This could be a side-effect of setuptools. I vaguely remember someone
> saying that this didn't work with distutils only.

Yes, I could see that.  setuptools plays all kinds of games to achieve
its ends, some of them broken.  Thank heaven for distutils2/packaging.

> If you can reproduce the failure, does adding a line before if __name__ ...:
>   import _jcc
> 
> solve the problem for you ?

No, I get an import error there -- apparently the relative import isn't
seen/found:

Traceback (most recent call last):
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/runpy.py",
 line 95, in run_module
    filename, loader, alter_sys)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/runpy.py",
 line 52, in _run_module_code
    mod_name, mod_fname, mod_loader)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/runpy.py",
 line 32, in _run_code
    exec code in run_globals
  File 
"/Library/Python/2.5/site-packages/JCC-2.12-py2.5-macosx-10.5-i386.egg/jcc/__init__.py",
 line 31, in <module>
    import _jcc
ImportError: No module named _jcc
make: *** [compile] Error 255


But using

  import jcc._jcc

does work.  Wonder if that works on Python 2.7, too?

Bill

Reply via email to