Sunday, July 1, 2012

python.m4 macro not for windows mingw32

This might not be a problem for you, but for a n00b like me, it's no fun.

python.m4 is part of automake-1.10. The issue is that if python is installed using windows binaries, then the mingw msys shell command:

    $ `$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')"

or

    $`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))"

returns ${prefix}\Lib\site-packages which in the msys shell turns into ${prefix}Libsite-packages which is nonsense.

My patch for it was to add use replace() to the command, i.e.: sysconfig.get_python_lib().replace('\\\\\','/'), to convert the windows backslash to a posix forward slash. I couldn't figure out how to fix this in the automake python.m4 macro, but I don't think it matters, since automake is really only used for Linux/Unix.

No comments:

Post a Comment

Fork me on GitHub