在 buildout.cfg 中指定获取鸡蛋的优先级
我想知道在查看 pypi.python.org/ 之前是否有一种方法可以指定首先从哪里获取鸡蛋
例如:
[buildout]
find-links:
/home/eggs/
eggs =
foo
bar
如果有 foo
或 bar
如果 pypi 上的软件包版本号高于我位于 /home/eggs/
中名为 foo
的软件包,buildout 将尝试从 pypi 下载该软件包。我的 foo 和 pypi foo 完全不同,这是一个问题。
我找不到使用命名空间或类似内容的方法,所以我想应该有一种方法可以强制构建使用某些包而不是其他包。
知道如何解决这个问题吗?
干杯, 马丁
I was wondering if there was a way to specify where eggs should be fetch from first before looking at pypi.python.org/
For example :
[buildout]
find-links:
/home/eggs/
eggs =
foo
bar
If there is foo
or a bar
package on pypi with a version number higher than my package called foo
located in /home/eggs/
, buildout will try to download the package from pypi instead. My foo
and pypi foo
being completely different, this is an issue.
I couldn't find a way to use namespaces or something similar, so I guess there should be a way to force buildout to use certain packages rather than others.
Any idea how to solve this?
Cheers,
Martin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将鸡蛋固定到特定版本,这样您就可以控制每次运行构建时使用哪些鸡蛋:
[buildout]
部分中的versions
选项允许您命名一个包含软件包版本引脚的部分。在此示例中,我将该部分命名为[versions]
,但您可以使用任何您喜欢的名称;想象一下,如果您有一个[release1]
和[release2]
部分,其中versions
选项指向其中一个来选择特定的版本组合引脚。当鸡蛋像这样固定到特定版本时,只有该版本的鸡蛋才能满足此构建的要求。如果您的 find-links 指向包含该版本的位置,那么将从那里下载 Egg,而不是从 PyPI 下载。
还有 2 个扩展功能可以帮助管理版本引脚。第一个是名为
allow-picked-versions
的默认构建选项:默认设置为
true
,这意味着构建可以为您选择一个满足所有要求的版本。当您将其设置为false
时,对于任何没有版本引脚构建的egg都会抛出错误。用它来检测您是否需要固定鸡蛋。另一种选择是使用 buildout.dumppickedversions 扩展来构建:
当添加到您的像这样的构建,每次运行构建时,对于任何未固定的鸡蛋,都会在末尾列出所选版本的列表,其格式直接适合包含在构建配置中。这样你就可以让 buildout 找出要使用的鸡蛋,然后将它们固定到这些版本。
You should pin your eggs to specific versions, that way you can control what eggs are used every single time you run the buildout:
The
versions
option in the[buildout]
section lets you name a section that contains version pins for your packages. In this example I named that section[versions]
, but you can use any name you like; imagine if you will a[release1]
and[release2]
section, with theversions
option pointing to either one to select a specific combination of version pins.When an egg is pinned to a specific version like this, only that version of the egg can satisfy the requirements of this buildout. If your find-links points to a location that contains that version then the egg will be downloaded from there and not from PyPI.
There are 2 more buildout features that can help manage version pins. The first is a default buildout option called
allow-picked-versions
:The default setting is
true
which means buildout can pick a version for you that otherwise satisfies all the requirements. When you set this tofalse
, for any egg that has no version pin buildout will throw an error. Use this to detect that you need to pin down eggs still.The other option would be to use the buildout.dumppickedversions extension to buildout:
When added to your buildout like that, every time you run your buildout a list of picked versions is listed at the end, for any egg that wasn't pinned, in a format directly suitable for inclusion in your buildout configuration. That way you can let buildout find out what eggs to use, then pin them down to those versions.