diff options
author | Dmitry Zagorny <dmitry.zagorny@intel.com> | 2015-09-14 13:05:00 -0500 |
---|---|---|
committer | Dmitry Zagorny <dmitry.zagorny@intel.com> | 2015-09-15 14:35:21 +0300 |
commit | ec97125439b6e0b4fdafba27b95367d38b7fd487 (patch) | |
tree | 1ce7c9d377e73a853c96771123ec32f340a4660f | |
parent | 72753bbdf8736a13f1cb60c25cf8683608f46e29 (diff) | |
download | numpy-ec97125439b6e0b4fdafba27b95367d38b7fd487.tar.gz |
Fixed issue: SciPy can't be build in case, if python was installed into
folder with whitespaces.
-rw-r--r-- | numpy/distutils/npy_pkg_config.py | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py index ceab906a4..6156439e1 100644 --- a/numpy/distutils/npy_pkg_config.py +++ b/numpy/distutils/npy_pkg_config.py @@ -3,7 +3,6 @@ from __future__ import division, absolute_import, print_function import sys import re import os -import shlex if sys.version_info[0] < 3: from ConfigParser import SafeConfigParser, NoOptionError @@ -56,35 +55,23 @@ def parse_flags(line): * 'ignored' """ - lexer = shlex.shlex(line) - lexer.whitespace_split = True - d = {'include_dirs': [], 'library_dirs': [], 'libraries': [], - 'macros': [], 'ignored': []} - def next_token(t): - if t.startswith('-I'): - if len(t) > 2: - d['include_dirs'].append(t[2:]) - else: - t = lexer.get_token() - d['include_dirs'].append(t) - elif t.startswith('-L'): - if len(t) > 2: - d['library_dirs'].append(t[2:]) + 'macros': [], 'ignored': []} + + flags = (' ' + line).split(' -') + for flag in flags: + flag = '-' + flag + if len(flag) > 0: + if flag.startswith('-I'): + d['include_dirs'].append(flag[2:].strip()) + elif flag.startswith('-L'): + d['library_dirs'].append(flag[2:].strip()) + elif flag.startswith('-l'): + d['libraries'].append(flag[2:].strip()) + elif flag.startswith('-D'): + d['macros'].append(flag[2:].strip()) else: - t = lexer.get_token() - d['library_dirs'].append(t) - elif t.startswith('-l'): - d['libraries'].append(t[2:]) - elif t.startswith('-D'): - d['macros'].append(t[2:]) - else: - d['ignored'].append(t) - return lexer.get_token() - - t = lexer.get_token() - while t: - t = next_token(t) + d['ignored'].append(flag) return d |