pypa/pip — pull request #1377 by muggenhor (2013-12-12 13:24:31+00:00)
Title: On a 32-bit Linux Python installation install 32-bit binary packages

I.e. instead of deciding to install 64-bit packages just because the
host systems' kernel is running in 64-bit mode.

The current/previous behaviour causes problems when I'm trying to install packages on a 32-bit Python installation running on a system with a 32bit kernel

$ uname -a
Linux m1001 2.6.34.9-rt-WR4.2.0.0_preempt_rt #1 SMP PREEMPT RT Fri Nov 29 22:11:53 MET 2013 x86_64 x86_64 x86_64 GNU/Linux
$ file `which python2.7`
/opt/python-2.7-x86_32/bin/python2.7: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.34, stripped
$ python2.7 -V
2.7.5
$ python2.7 -c 'import distutils.util, platform ; print distutils.util.get_platform(), platform.architecture()'
linux-x86_64 ('32bit', 'ELF')

This patch catches this error and fixes it. Albeit in a hackish way.