在使用setuptools构建软件包时,如何避免无效警告?

时间:2016-03-14 09:41:06

标签: python setuptools

似乎setuptools会触发真正零价值的各种警告,我想摆脱它们,因为它们正在发送持续集成进程的垃圾邮件,更难以发现真正的警告。

以下是我想要摆脱的内容:

python setup.py -q bdist_wheel
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*.pyo' found under directory '*'
warning: no previously-included files matching '*.orig' found under directory '*'
warning: no files found matching '*.md' under directory 'releases'
warning: no files found matching '*.rst' under directory 'releases'
warning: no files found matching '*.json' under directory 'releases'
warning: no previously-included files matching '*' found under directory 'examples/node_modules'
no previously-included directories found matching 'examples/node_modules'
warning: build_py: byte-compiling is disabled, skipping.

warning: install_lib: byte-compiling is disabled, skipping.

似乎所有这些都是由MANIFEST.in文件引起的,但那里的条件确实存在,并且当排除模式确实找不到匹配的文件时,这显然不会产生警告?!

2 个答案:

答案 0 :(得分:1)

目前我发现此问题只有一个解决方法: function addSelectedItemFromRemoteAutocomplete(item) { if (item && item.originalObject) { vm.selectedItems.push(item); } } 这样可以避免在构建期间收到这些恼人的警告。

答案 1 :(得分:0)

我使用makefile来构建我的项目,并且必须在顶部添加以下行:

unexport PYTHONDONTWRITEBYTECODE

在shell中,您也必须unset PYTHONDONTWRITEBYTECODE。将其从1设置为0无效。不过,我使用的是zsh,所以上面的答案也许可以在其他地方使用。

此外,您可以直接将-B传递给python以禁用字节编译,但是环境变量优先于它(至少在我正在使用的Python 3版本中--{{1} }。不过,我看不到强制打开字节编译的选项。

最后,您可以将3.6.8传递给大多数--help命令,以获取有关它们支持的标志的信息。例如,setup.pybuild_py支持install_lib--compile/-c标志,这些标志应该有助于您进行细粒度控制,尽管环境变量再次以我的经验为准。