Building PyLucene

PyLucene is completely code-generated by JCC whose sources are included with the PyLucene sources.

Requirements

To build PyLucene a Java Development Kit (JDK) and Ant are required; use of the resulting PyLucene binaries requires only a Java Runtime Environment (JRE).

The setuptools package is required to build and run PyLucene on Python 2.3.5. With later versions of Python, setuptools is only required for shared mode. See JCC's installation instructions for more information.

For the Impatient Ones

  • pushd jcc
  • <edit setup.py to match your environment>
  • python setup.py build
  • sudo python setup.py install
  • popd
  • <edit Makefile to match your environment>
  • make
  • make test (look for failures)
  • sudo make install

For the Rest of Us

Before building PyLucene, JCC must be built first. See JCC's installation instructions for building and installing it.

Once JCC is built and installed, PyLucene is built via make which invokes JCC. See PyLucene's Makefile for configuration instructions.

There are limits to both how many files can fit on the command line and how large a C++ file the C++ compiler can handle. By default, JCC generates one large C++ file containing the source code for all wrapper classes.

Using the --files command line argument, this behaviour can be tuned to workaround various limits, for example:

  • to break up the large wrapper class file into about 2 files:
    --files 2

  • to break up the large wrapper class file into about 10 files:
    --files 10

  • to generate one C++ file per Java class wrapped:
    --files separate

Notes for Solaris 11 with Sun Studio C++ 12

PyLucene's Makefile is a GNU Makefile. Be sure to use gmake instead of plain make.

Just as when building JCC, Python's distutils must be nudged a bit to invoke the correct compiler. Sun Studio's C compiler is called cc while its C++ compiler is called CC.

To build PyLucene, use the following shell command to ensure that the C++ compiler is used:
$ CC=CC gmake

Notes for Solaris 11.1 with GCC 4.5

PyLucene's Makefile is a GNU Makefile. Be sure to use gmake instead of plain make.

  • Edit Makefile and do the following changes:
    Insert and enable a Solaris-Section with the following content

Solaris (Solaris 11.1, Python 2.6, 32-bit, Java 1.7)

PREFIX_PYTHON=/usr ANT=/usr/bin/ant PYTHON=$(PREFIX_PYTHON)/bin/python JCC=$(PYTHON) -m jcc.main --reserved DEFAULT_TYPE NUM_FILES=4 - gmake - su gmake install

The Apache Software Foundation

The Apache Software Foundation provides support for the Apache community of open-source software projects. The Apache projects are defined by collaborative consensus based processes, an open, pragmatic software license and a desire to create high quality software that leads the way in its field. Apache Lucene, Apache Solr, Apache PyLucene, Apache Open Relevance Project and their respective logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.