Archive for July, 2007

Accessing SWORD from python

July 7, 2007

The current 1.5.9 SWORD library release requires a bit of fiddling to be accessible from python. This is on ArchLinux. I found good (if incomplete) information in a thread on the sword developers mailing list.

The SWORD Project is the CrossWire Bible Society’s free Bible software project. Its purpose is to create cross-platform open-source tools– covered by the GNU General Public License– that allow programmers and Bible societies to write new Bible software more quickly and easily.

  1. Upgrade to swig 1.3.31 or higher which supports python 2.5. This resolves a
    compilation error caused by a const char*/char* mismatch. SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl, Ruby and PHP.
  2. tar xzvf sword-1.5.9.tar.gz
  3. From the Sword base directory where the .tar.gz file was extracted,
    cd bindings/swig/package
  4. Edit and correct the Sword version number in three
    places. AC_INIT, AM_INIT_AUTOMAKE and the variable SW_CHECK_SWORD refers to the lowest
    supported version of the Sword libraries. Bump it to 1.5.9.
  5. Add libtoolize to the start of to resolve ./ not found
  6. ./ Create make files
  7. ./configure If necessary, specify other options such as –prefix
    or –with-python=path. See configure –help for more information.
  8. make pythonswig Generate the SWIG bindings and, required to generate Sword.cxx
  9. make If you just run make, it will create Makefiles for all the
    language bindings found by configure.
  10. cd python; sudo ./ install Install Python Sword bindings (chmod +x might be necessary on
  11. Advertisements