]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: check arguments also when searching for "clang" 33177/head
authorKefu Chai <kchai@redhat.com>
Mon, 10 Feb 2020 14:06:24 +0000 (22:06 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 10 Feb 2020 14:10:04 +0000 (22:10 +0800)
if "ccache" is used, compiler[0] would be "ccache", and compiler[1]
would be "clang", in this case, we should search for "clang" until
an argument starting with "-" is found. it signals be the first
cflag passed to the compiler.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/cephfs/setup.py
src/pybind/rados/setup.py
src/pybind/rbd/setup.py
src/pybind/rgw/setup.py

index 84767b460ac9770b0999b3230f57f2ead6d58b8a..19ae6c329afa71a16da9c46d005d88170946778e 100755 (executable)
@@ -9,12 +9,13 @@ import tempfile
 import textwrap
 from distutils.ccompiler import new_compiler
 from distutils.errors import CompileError, LinkError
-from itertools import filterfalse
+from itertools import filterfalse, takewhile
 import distutils.sysconfig
 
 
 def filter_unsupported_flags(compiler, flags):
-    if 'clang' in compiler:
+    args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
+    if any('clang' in arg for arg in args):
         return list(filterfalse(lambda f:
                                 f in ('-mcet',
                                       '-fstack-clash-protection',
index fe51bcd4e0d9e7a7f725a7dd0d15af9dddce4761..e2c5696404089bbb25ada39d810384606346613e 100755 (executable)
@@ -2,7 +2,7 @@ from __future__ import print_function
 import distutils.sysconfig
 from distutils.errors import CompileError, LinkError
 from distutils.ccompiler import new_compiler
-from itertools import filterfalse
+from itertools import filterfalse, takewhile
 
 import os
 import pkgutil
@@ -14,7 +14,8 @@ import textwrap
 
 
 def filter_unsupported_flags(compiler, flags):
-    if 'clang' in compiler:
+    args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
+    if any('clang' in arg for arg in args):
         return list(filterfalse(lambda f:
                                 f in ('-mcet',
                                       '-fstack-clash-protection',
index b1f849874149f5b2d62a27b1200cd03d8a10e7c0..634484f14029bdbbd961667d225ef14ec541c880 100755 (executable)
@@ -9,12 +9,13 @@ import tempfile
 import textwrap
 from distutils.ccompiler import new_compiler
 from distutils.errors import CompileError, LinkError
-from itertools import filterfalse
+from itertools import filterfalse, takewhile
 import distutils.sysconfig
 
 
 def filter_unsupported_flags(compiler, flags):
-    if 'clang' in compiler:
+    args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
+    if any('clang' in arg for arg in args):
         return list(filterfalse(lambda f:
                                 f in ('-mcet',
                                       '-fstack-clash-protection',
index cb5024820b5ff63e5396d4bb0f991de350264483..eb1591a460ae8b77b2bd6556c438c052ccef2122 100755 (executable)
@@ -10,11 +10,13 @@ import tempfile
 import textwrap
 from distutils.ccompiler import new_compiler
 from distutils.errors import CompileError, LinkError
+from itertools import filterfalse, takewhile
 import distutils.sysconfig
 
 
 def filter_unsupported_flags(compiler, flags):
-    if 'clang' in compiler:
+    args = takewhile(lambda argv: not argv.startswith('-'), [compiler] + flags)
+    if any('clang' in arg for arg in args):
         return list(filterfalse(lambda f:
                                 f in ('-mcet',
                                       '-fstack-clash-protection',