Commit b2e6c0e7 authored by André Anjos's avatar André Anjos 💬
Browse files

Filter isystem includes smartly

parent 330dc752
......@@ -94,6 +94,25 @@ def generate_self_macros(extname, version):
return retval
def reorganize_isystem(args):
"""Re-organizes the -isystem includes so that more specific paths come first"""
remainder = []
includes = []
iterable = iter(args)
for k in iterable:
if k in ('-isystem',):
k = iterable.next()
includes.append(k)
else:
remainder.append(k)
includes = uniq(includes[::-1])[::-1]
retval = [tuple(remainder)] + [('-isystem', k) for k in includes]
from itertools import chain
return list(chain.from_iterable(retval))
class Extension(DistutilsExtension):
"""Extension building with pkg-config packages.
......@@ -247,6 +266,9 @@ class Extension(DistutilsExtension):
# Uniq'fy parameters that are not on our parameter list
kwargs['include_dirs'] = uniq(kwargs['include_dirs'])
# Stream-line '-isystem' includes
kwargs['extra_compile_args'] = reorganize_isystem(kwargs['extra_compile_args'])
# Make sure the language is correctly set to C++
kwargs['language'] = 'c++'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment