使用 zc.buildout 指定自定义 PYTHON_EGG_CACHE 目录?
我们在尝试部署许多使用 zc.buildout 的项目时遇到了问题 - 具体来说,我们发现他们希望将 PYTHON_EGG_CACHE
目录放在整个节目中。我们希望以某种方式将此目录设置为与内置项目同一级别的目录,在其中可以找到 eggs
。
网上有人提到这可以为 Plone 项目完成,但是没有 Plone 是否可以做到这一点?
是否有一些方法可以设置环境变量,以便我们可以在 ./bin
中设置 PYTHON_EGG_CACHE
可执行文件?
We're having problems when trying to deploy a number of projects which use zc.buildout - specifically we're finding that they want to put their PYTHON_EGG_CACHE
directories all over the show. We'd like to somehow set this directory to one at the same level as the built-out project, where eggs
can be found.
There is some mention online that this can be done for Plone projects, but is it possible to do this without Plone?
Are there some recipes that can set up an environment variable so we can set the PYTHON_EGG_CACHE
executable files in ./bin
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PYTHON_EGG_CACHE 仅用于压缩鸡蛋,你最好的选择是让 zc.buildout 安装所有需要解压缩的鸡蛋:
如果你的系统 python 安装了压缩鸡蛋,但仍然需要解压缩才能访问资源,并且在脚本中设置 PYTHON_EGG_CACHE 是你唯一的选择选项(而不是为用户设置环境变量),您可以尝试使用 zc.recipe.egg 的
initialization
选项将任意 Python 代码添加到脚本中:The PYTHON_EGG_CACHE is only used for zipped eggs, your best bet is to have zc.buildout install all required eggs unzipped:
If your system python has zipped eggs installed that still require unzipping for resource access, and setting the PYTHON_EGG_CACHE in your scripts is your only option (as opposed to setting the environment variable for your user), you could try to use the
initialization
option of zc.recipe.egg to add arbitrary Python code to your scripts:我不确定你的意思。您通常拥有的三个选项:
默认情况下,Buildout 将 Eggs 存储在 buildout 目录内名为
eggs/
的目录中。您可以将 buildout.cfg 的
[buildout]
部分中的eggs-dir
变量设置为某个目录。只需告诉它把它们放在哪里即可。您还可以在主目录内的
.buildout/defaults.cfg
中设置相同的选项。这样您就可以为所有项目设置默认值。方便地将所有鸡蛋存储在一个地方:例如,这可以节省大量下载时间。其中之一(尤其是最后一个)能实现您想要的吗?
并且:不要在生成的
bin/*
文件中乱扔鸡蛋。让buldout去摘蛋,这就是它的目的。I'm not sure what you mean. Three options that you normally have:
Buildout, by default, stores the eggs in a directory called
eggs/
inside your buildout directory.You can set the
eggs-dir
variable inside your buildout.cfg's[buildout]
section to some directory. Just tell it where to place them.You can also set that very same option in
.buildout/defaults.cfg
inside your home directory. That way you can set a default for all your projects. Handy for storing all your eggs in one place: that can save a lot of download time, for instance.Does one of those (especially the last one) accomplish what you want?
And: don't muck around with eggs in the generated
bin/*
files. Let buldout pick the eggs, that's its purpose.