Fix python build inc_dirs[] and lib_dirs[] for linux/darwin

Previously setup.py excludes module like zlib because it
fails to locate zlib.h.  The reason on linux is that GCC-reported paths
(via gcc -E -v - < /dev/null) containing /gcc/ are excluded.
Unfortunately $NDK/build/tools/build-host-python.sh use GCC in
$AOSP/prebuilts/gcc/{linux-x86,darwin-x86}/host whose path
contains "/gcc/", and causes all paths being excluded, even though
zlib.h is under linux-x86/host's sysroot.  This CL fixes it by excluding
/lib/gcc/ instead.

The reason for darwin is that the old gcc 4.2.1 doesn't report
LIBRARY_PATH which causes lib_dirs[] to be empty.  Fix it to call
gcc with -print-search-dirs instead.  The library path may contain
non-existance paths, but work fine for our purpose

This CL enables additional modules:
linux: zlib, nis, crypt, _curses and _curses_panel
darwin: zlib, bz2, _curses, _curses_panel, _hashlib, _ssl

The mingw cross-tool doesn't have zlib, so the python.exe in
windows pacakges remain lack of zlib module (and some others)

See b.android.com/59902

Change-Id: I4d393624a9ceb808955ddea9687cb2013a4fd1d2
1 file changed
tree: d1d8724c91f339f869fc9292e38e6b00ab5d2611
  1. Python-2.7.3/
  2. Python-2.7.4/
  3. Python-2.7.5/