improve portability of generate_swig.py