Remove all bashisms from build.sh

Most changes are straightforward, like replacing unnecessary [[ with [.
The only significant change was to the detection of Python’s version
number : the previous approach used regexes and string indexes, which
is rather fragile. We now use sys.version_info.{major, minor} instead.

This was done as a preparation for
refs https://github.com/Valloric/YouCompleteMe/issues/1290
Merge pull request #69 from Grimy/no-bashisms

Remove all bashisms from build.sh