numpy/numpy — pull request #4421 by meltingwax (2014-03-02 17:59:06+00:00)
Title: BUG: Fix support for builds with directories that contain whitespace

Fixes #4382. @MichaelAdello reported a build failing for a directory that contained whitespace, and narrowed the problem down to ``parse_flags(line)`` not supporting whitespace in directory names. This PR enables POSIX mode in the lexer, which adds support for quotes and backslash escaping.

Quote from issue #4382:
> The ``parse_flags(line)`` function uses [``shlex.shlex``](http://docs.python.org/2/library/shlex.html#shlex.shlex) from the python stdlib. By default ``shlex.shlex`` is rather stupid. We can pass an option to ``shlex.shlex`` that will enable POSIX mode, that will allow for smart interpreting of quotes and escaping (as you would expect from a shell). Then you could do any of these:
```python
>>> from numpy.distutils.npy_pkg_config import parse_flags
>>> d = parse_flags('"-L/my_folder/with whitespaces/in_it"')
>>> d = parse_flags('-L/my_folder/"with whitespaces"/in_it')
>>> d = parse_flags('-L/my_folder/with\\ whitespaces/in_it')
```

In the tests, I'm using ```self.assertTrue(x == y)``` over ```assert_equal(x, y)``` to keep it consistent with the rest of the file.