Rewrite in python. Supports setup.py