在 buildout.cfg 中指定获取鸡蛋的优先级

发布于 2024-10-15 06:09:33 字数 425 浏览 2 评论 0原文

我想知道在查看 pypi.python.org/ 之前是否有一种方法可以指定首先从哪里获取鸡蛋

例如:

[buildout]
find-links:
    /home/eggs/

eggs =
    foo
    bar

如果有 foobar如果 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜未央樱花落 2024-10-22 06:09:33

您应该将鸡蛋固定到特定版本,这样您就可以控制每次运行构建时使用哪些鸡蛋:

[buildout]
versions = versions

[versions]
foo = 1.0
bar = 1.1
spam = 1.0b2

[buildout] 部分中的 versions 选项允许您命名一个包含软件包版本引脚的部分。在此示例中,我将该部分命名为 [versions],但您可以使用任何您喜欢的名称;想象一下,如果您有一个 [release1][release2] 部分,其中 versions 选项指向其中一个来选择特定的版本组合引脚。

当鸡蛋像这样固定到特定版本时,只有该版本的鸡蛋才能满足此构建的要求。如果您的 find-links 指向包含该版本的位置,那么将从那里下载 Egg,而不是从 PyPI 下载。

还有 2 个扩展功能可以帮助管理版本引脚。第一个是名为 allow-picked-versions 的默认构建选项:

[buildout]
allow-picked-versions = false

默认设置为 true,这意味着构建可以为您选择一个满足所有要求的版本。当您将其设置为false时,对于任何没有版本引脚构建的egg都会抛出错误。用它来检测您是否需要固定鸡蛋。

另一种选择是使用 buildout.dumppickedversions 扩展来构建:

[buildout]
extensions = 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:

[buildout]
versions = versions

[versions]
foo = 1.0
bar = 1.1
spam = 1.0b2

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 the versions 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:

[buildout]
allow-picked-versions = false

The default setting is true which means buildout can pick a version for you that otherwise satisfies all the requirements. When you set this to false, 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:

[buildout]
extensions = buildout.dumppickedversions

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文