File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
2
import os .path
3
+ import shlex
3
4
import sys
5
+ import sysconfig
4
6
5
7
6
8
# C++ is only supported on Python 3.6 and newer
@@ -48,6 +50,24 @@ def main():
48
50
except ImportError :
49
51
from distutils .core import setup , Extension
50
52
53
+ # gh-105776: When "gcc -std=11" is used as the C++ compiler, -std=c11
54
+ # option emits a C++ compiler warning. Remove "-std11" option from the
55
+ # CC command.
56
+ cmd = (sysconfig .get_config_var ('CC' ) or '' )
57
+ if cmd is not None :
58
+ cmd = shlex .split (cmd )
59
+ cmd = [arg for arg in cmd if not arg .startswith ('-std=' )]
60
+ if (sys .version_info >= (3 , 8 )):
61
+ cmd = shlex .join (cmd )
62
+ elif (sys .version_info >= (3 , 3 )):
63
+ cmd = ' ' .join (shlex .quote (arg ) for arg in cmd )
64
+ else :
65
+ # Python 2.7
66
+ import pipes
67
+ cmd = ' ' .join (pipes .quote (arg ) for arg in cmd )
68
+ # CC env var overrides sysconfig CC variable in setuptools
69
+ os .environ ['CC' ] = cmd
70
+
51
71
cflags = ['-I' + SRC_DIR ]
52
72
cppflags = list (cflags )
53
73
if not MSVC :
You can’t perform that action at this time.
0 commit comments