Skip to content
Scott Pakin edited this page Jul 21, 2015 · 2 revisions

This program is really just a demonstration of how to use the SWIG interface to the bfbin library. First, you'll need to create a Python module. To do so, create a file called setup.py with the following contents:

#! /usr/bin/env python

"Install a bfbin module"

from distutils.core import setup, Extension

bfbin_module = Extension('_bfbin',
                         sources              = ["bfbin-swig_wrap.c"],
                         include_dirs         = ["/usr/local/include"],
                         library_dirs         = ["/usr/local/lib"],
                         runtime_library_dirs = ["/usr/local/lib"],
                         libraries            = ["bfbin-swig"])

setup(name = 'bfbin',
      version              = "1.1",
      author               = "Scott Pakin",
      author_email         = "[email protected]",
      description          = "Parse Byfl binary output files",
      ext_modules          = [bfbin_module],
      py_modules           = ["bfbin"])

Then, follow the SWIG documentation guideliness on how to build a Python module. The following commands should work:

swig -python -o bfbin-swig_wrap.c /usr/local/include/byfl/bfbin-swig.h
python setup.py install

After that, you ought to be able to run bfbin2py.

Clone this wiki locally