8000 Backport gh-6243 by charris · Pull Request #6340 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Backport gh-6243 #6340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 22, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed issue: SciPy can't be build in case, if python was installed into
folder with whitespaces.
  • Loading branch information
dmitrii-zagornyi authored and charris committed Sep 22, 2015
commit c628401a42529129d3662f76b96da8278d9f066f
43 changes: 15 additions & 28 deletions numpy/distutils/npy_pkg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys
import re
import os
import shlex

if sys.version_info[0] < 3:
from ConfigParser import SafeConfigParser, NoOptionError
Expand Down Expand Up @@ -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

Expand Down
0