gpt4 book ai didi

python - 我如何说服 setuptools 为来自 setup_require 或 tests_require 的 require 包使用一个临时目录?

转载 作者:太空狗 更新时间:2023-10-30 01:35:02 27 4
gpt4 key购买 nike

setup.py 里面我有这样的东西:

setup_requires=['nose>=1.0'],
tests_require=[],

问题是,当我运行 ./setup.py test 时,它会下载这些模块并将其解压缩到 setup.py 目录中。

我怎样才能说服它为此使用一个临时目录,我不想用这些污染源代码控制系统,我也不想开始添加很多很多排除模式。

最佳答案

如果问题出在您的项目的源代码树上,您可能应该编写一个脚本来删除在安装测试结束时由 distutils 创建的所有“dist”和“build”目录。下载的包通常是源代码树中的 *.egg 文件夹。

您没有污染您的发行版。

来自 setuptools 文档:

setup_requires will NOT be automatically installed on the system where the setup script is being run. They are simply downloaded to the setup directory if they’re not locally available already. If you want them to be installed, as well as being available when the setup script is run, you should add them to install_requires and setup_requires.)

tests_require If your project’s tests need one or more additional packages besides those needed to install it, you can use this option to specify them. It should be a string or list of strings specifying what other distributions need to be present for the package’s tests to run. When you run the test command, setuptools will attempt to obtain these (even going so far as to download them using EasyInstall). Note that these required projects will not be installed on the system where the tests are run, but only downloaded to the project’s setup directory if they’re not already installed locally.

http://packages.python.org/distribute/setuptools.html

如果你已经安装了一些包并且你需要删除它,只需在 python 发行版的子文件夹“site-packages”中找到你的包并将其删除。最后删除 easy-install.pth 文件中的包引用它通常位于相同的“站点包”目录中。

关于python - 我如何说服 setuptools 为来自 setup_require 或 tests_require 的 require 包使用一个临时目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10703601/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com