[pylucene-dev] building PyLucene in script; diffs between Python 2.5 and 2.4?

Bill Janssen janssen at parc.com
Mon Jun 16 19:12:41 PDT 2008


I'm trying to work out a single script for building PyLucene from a
source tarball on a Linux distribution.  I've got two distributions
handy, Red Hat (Fedora, CentOS) and Ubuntu.  The CentOS machine is
running Python 2.4.3, apparently the latest release for CentOS, and
the Ubuntu machine is running Python 2.5.2.  Both have the latest
setuptools installed.  I'm using Sun Java 1.5.0 on each.

My tcsh script looks like this ($javahome is the Java home, and
$python is the Python interpreter):

    # we need to know whether to use 32-bit or 64-bit libraries
    set arch=`${python} -c "import platform; print platform.uname()[4]"`
    # we need to know whether Python supports the -m commandline flag
    set moduleflag=`${python} -c "import sys; print (sys.version_info >= (2, 5)) and '1' or '0'"`

    echo "javahome is $javahome, arch is $arch, moduleflag is $moduleflag"

    setenv JCC_ARGSEP ";"
    setenv JCC_INCLUDES "${javahome}/include;${javahome}/include/linux"
    if (($arch == "x86_64") || ($arch == "amd64")) then
       setenv JCC_LFLAGS "-L${javahome}/jre/lib/amd64;-ljava;-Wl,-rpath=${javahome}/jre/lib/amd64:${javahome}/jre/lib/amd64/server"
    else
       setenv JCC_LFLAGS "-L${javahome}/jre/lib/i386;-ljava;-Wl,-rpath=${javahome}/jre/lib/i386:${javahome}/jre/lib/i386/client"
    endif
    cd jcc
    ${python} setup.py install
    cd ..
    setenv JAVA_HOME "$javahome"	# for ant
    if ($moduleflag == "1") then
       set JCCCOMMAND="${python} -m jcc --shared"
    else
       setenv PYTHONPATH ./jcc/build/lib.*/jcc
       set JCCCOMMAND="${python} ${PYTHONPATH}/__init__.py --shared"
    endif
    echo $JCCCOMMAND
    make PREFIX_PYTHON=/usr ANT=ant PYTHON=${python} JCC="${JCCCOMMAND}" NUM_FILES=1
    make PREFIX_PYTHON=/usr ANT=ant PYTHON=${python} JCC="${JCCCOMMAND}" NUM_FILES=1 install
    unsetenv PYTHONPATH

My question is, why can't I use the same JCCCOMMAND on both Pythons?
When I try to use the __init__.py form with Python 2.5, I get an
unusable PyLucene install (the ImportError is that _lucene.so doesn't
include the symbol "init_lucene").

Bill


More information about the pylucene-dev mailing list