Accessing SWORD from python

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 configure.ac 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 autogen.sh to resolve ./ltmain.sh not found
  6. ./autogen.sh 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 setup.py, 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 ./setup.py install Install Python Sword bindings (chmod +x might be necessary on setup.py)
  11. Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: