| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,15 @@ | |||
| 1 | 1 | #!/usr/bin/env python3 | |
| 2 | 2 | import os.path | |
| 3 | + import shlex | ||
| 3 | 4 | import 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 | ||
| 4 | 13 | ||
| 5 | 14 | ||
| 6 | 15 | # C++ is only supported on Python 3.6 and newer | |
@@ -43,10 +52,23 @@ | |||
| 43 | 52 | ||
| 44 | 53 | ||
| 45 | 54 | def 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 | ||
| 50 | 72 | ||
| 51 | 73 | cflags = ['-I' + SRC_DIR] | |
| 52 | 74 | cppflags = list(cflags) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments