Hello Kevin,

Python-GLPK from
http://www.dcc.fc.up.pt/~jpp/code/python-glpk/
uses SWIG for building.

This is what it takes to build on Debian:

#install SWIG
sudo apt-get install swig
#Download the source
wget http://www.dcc.fc.up.pt/~jpp/code/python-glpk/python-glpk_0.4.43.orig.tar.gz
# unzip
tar -xzf python-glpk_0.4.43.orig.tar.gz
# goto source directory
cd python-glpk-0.4.43/src
# make and install
sudo make install
# move to examples
cd ../examples
# run an example
python example.py

Building on OS X will require to modify src/swig/Makefile.

You will have to change the following line
gcc -Wall -shared glpkpi.o  glpkpi_wrap.o -lm -lglpk  -o _glpkpi.so

The following page contains some useful information on using SWIG on OS X.
http://www.penzilla.net/tutorials/python/swig/

In src/setup.py you may have to change pathes.

In src/Makefile rework the clean section.

If you are successful, please, post a message with your Makefiles.

In Python-GLPK the following is missing:
- handling API errors without aborting
- callbacks

If you look at GLPK for Java you can get an idea off the effort to build a language binding with SWIG that handles these.

The official documentation for extending Python can be found at:
http://docs.python.org/extending/

The following book has a useful chapter on extending Python:
Mark Lutz, Programming Python, O'Reilly Media, ISBN 0596158106
http://www.rmi.net/~lutz/about-pp4e.html

Best regards

Xypron


Nigel Galloway wrote:
Kevin,

You may wish to try building the bindings using SWIG, see:

http://lists.gnu.org/archive/html/help-glpk/2007-05/msg00076.html

and

http://lists.gnu.org/archive/html/help-glpk/2009-03/msg00023.html

SWIG is well documented and included with most recent linux distributions. It 
is the technology used for glpk-java. Unfortuanately the files I used for 
Python are no longer on the web. but they can be recovered and I will assist 
you if you find difficulties.

The only difficulty I have experienced is that 'in' and 'out' are reseved words 
in Python and glpk uses them as procedure names. SWIG has a default work around 
for this.

Good Luck

Nigel



_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to