distutils正在删除Wstrictprototypes标志my设置.py

2024-06-16 09:08:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我写了我自己的setup.py文件。在

但是我一直收到一个-Wstrict-prototypes的警告,充斥着整个屏幕。在

我试了几行来删除它,但它不起作用。在

有什么想法吗?在

example_module = Extension('_example',
                           sources=['example_wrap.cxx', 'example.cpp'],
                           extra_compile_args=['-std=c++11']
                           )

setup (name = '_example',
       version = '0.1',
       author      = "SWIG Docs",
       description = """Simple swig simple_ex from docs""",
       ext_modules = [example_module],
       py_modules = ["example"],
       )

# removing -Wstrict-prototypes flag which is not valid for c++
cfg_vars = distutils.sysconfig.get_config_vars()
if "CFLAGS" in cfg_vars:
  cfg_vars["CFLAGS"] = cfg_vars["CFLAGS"].replace("-Wstrict-prototypes", "")

Tags: 文件pymodules警告屏幕examplesetupextension