I just uploaded a prototype python wrapper for the new library
interface to polymake on bitbucket:
https://bitbucket.org/burcin/pypolymake
The docstrings in polymake.pyx contain examples of what is possible
right now:
https://bitbucket.org/burcin/pypolymake/src/tip/polymake.pyx#cl-105
The wrapper looks much uglier than it should be. I wanted to use the
C++ support in Cython. Unfortunately, I couldn't get many things
working with the Cython version in Sage (0.14). I didn't try installing
the latest version of Cython (0.15).
Getting the wrapper working, that is, installing Sage, polymake and the
wrapper properly is a major hassle. There are instructions below
describing how I set up my testing environment within Sage.
A few remarks:
- The latest polymake version (2.10) doesn't build with the partial
boost install that comes with Sage. I just used a package I had
from a prerelease.
- Embedding perl in a python module is quite an adventure. Perl needs
the RTLD_GLOBAL flag to be set so that the modules it loads can find
symbols from the main (perl) library. However, modifying dlopenflags
with sys.setdlopenflags() doesn't help (at least on my machine).
It seems that adding the polymake library to LD_PRELOAD is the only
solution for now.
Installation instructions:
- get a recent Sage version (we won't apply any patches to Sage)
- Update the MPFI and MPFR versions in Sage
./sage -i
http://sage.math.washington.edu/home/burcin/polymake/mpfi-1.5.spkg
./sage -i
http://sage.math.washington.edu/home/burcin/polymake/mpfr-3.0.0.spkg
- Rebuild MPIR:
./sage -f spkg/standard/mpir-1.2.2.p2.spkg
- Install (old) polymake:
http://sage.math.washington.edu/home/burcin/polymake/polymake-2.9.10.p0.spkg
- rebuild (part of) Sage library so that it works with the updates
./sage -b
- go to $SAGE_ROOT/local/bin and apply attached sage-env.patch
cd local/bin
hg qimport sage-env.patch
hg qpush
- Clone the wrapper
hg clone https://bitbucket.org/burcin/pypolymake
- Start a sage shell, go into the wrapper directory and install
./sage -sh
cd <wrapper_dir>
python setup.py install
- Preferably on a different shell, start sage and enjoy
Comments & suggestions welcome.
Cheers,
Burcin