[英]How can I avoid getting useless warnings while building my package using setuptools?
It seems that setuptools triggers various warnings that are really of zero value and I want to get rid of them as they are spamming the continuous integration progress, making just harder to spot real warnings. 似乎setuptools触发了真正零价值的各种警告,我想摆脱它们,因为它们正在发送持续集成进程的垃圾邮件,使得更难发现真正的警告。
Here are those that I do want to get rid of: 这些是我想要摆脱的:
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.
It seems that all these are caused by the MANIFEST.in
file but the conditions there do have a reason for being there, and that's clearly not the one of generating warnings when exclude patters do find no files to match?! 似乎所有这些都是由
MANIFEST.in
文件引起的,但那里的条件确实存在,并且当排除模式确实找不到匹配的文件时,这显然不是产生警告的那个?!
目前我发现这个问题只有一个解决方法: export PYTHONDONTWRITEBYTECODE=
这样可以避免在构建期间收到这些恼人的警告。
I use a makefile to build my project and I had to add the following line to the top: 我使用makefile来构建我的项目,我不得不将以下行添加到顶部:
unexport PYTHONDONTWRITEBYTECODE
In shell, you must unset PYTHONDONTWRITEBYTECODE
, too. 在shell中,你也必须
unset PYTHONDONTWRITEBYTECODE
。 Setting it from 1
to 0
won't work. 将其从
1
设置为0
将不起作用。 I am using zsh
though, so maybe the answer above will work elsewhere. 我虽然使用
zsh
,所以上面的答案可能会在其他地方使用。
Also, you can pass -B
to python
directly to disable byte-compiling, but the environment variable takes precedence over it (at least in the Python 3 version I am using - 3.6.8
). 此外,您可以直接将
-B
传递给python
以禁用字节编译,但环境变量优先于它(至少在我使用的Python 3版本中是3.6.8
)。 I do not see an option to force turning on byte-compiling, though. 但是,我没有看到强制打开字节编译的选项。
Lastly, you can pass --help
to most setup.py
commands to get info on flags they support. 最后,您可以将
--help
传递给大多数setup.py
命令,以获取有关它们支持的标志的信息。 For example, build_py
and install_lib
support --compile/-c
, --no-compile
flags which should help you with fine-grain control, although the environment variable again takes precedence from my experience. 例如,
build_py
和install_lib
支持--compile/-c
, --no-compile
--compile/-c
--no-compile
标志,它们可以帮助您进行细粒度控制,尽管环境变量再次优先于我的经验。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.