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