构建:通过 Mercurial 包含另一个 Python 项目?

发布于 2024-08-19 21:54:27 字数 999 浏览 3 评论 0原文

我有一个名为 Foo/ 的项目,其中包含 buildout.cfg 和 setup.py。现在有另一个名为 Bar/ .. 的项目,它也有 buildout.cfg 和 setup.py。由于 Bar/ 依赖于各种 Python 模块,因此它的 setup.py 中有 install_requires=['lxml', 'SQLAlchemy'] 。 Foo/ 取决于 Bar/。

但 Bar/ 还没有发布。如何将 Bar/ 包含在 Foo 的构建中,以便可以导入 Bar 的模块、lxml 和 SQLAlchemy?

假设 Bar/ 使用 Mercurial 作为其版本控制系统。

我的尝试构建 Mercurial 配方< /a> 没有做太多事情。它仅克隆存储库,但不会自动获取 Bar/setup.py 中 install_requires 的 Egg 并将 Bar/ 本身添加到 sys.path 中。

实际示例:这是我的 buildout.cfg 的样子(Bar == Mercurialrecipe 包):

[buildout]
parts = ... pyrtm ...
develop = . parts/pyrtm
eggs = pyrtm

[pyrtm]
recipe = mercurialrecipe
repository = http://bitbucket.org/srid/pyrtm

...

这不起作用,因为 sys.path 不包含本地克隆的 Mercurialrecipe 的路径(在 parts/ 中) mr),并且依赖项(来自 parts/mr/setup.py)未安装。

I have a project called Foo/ that has buildout.cfg and setup.py. Now there is another project called Bar/ .. which too has buildout.cfg and setup.py. Since Bar/ depends on various Python modules, it has install_requires=['lxml', 'SQLAlchemy'] in its setup.py. Foo/ depends on Bar/.

But Bar/ does not have a release yet. How do I include Bar/ in Foo's buildout so that I can import Bar's modules, lxml and SQLAlchemy?

Assume that Bar/ is using mercurial as its revision control system.

My attempt: Buildout mercurial recipe does not do much. It only clones the repository, but does not automatically get the eggs for install_requires in Bar/setup.py and add Bar/ itself to sys.path.

Actual example: Here's what my buildout.cfg looks like (Bar == mercurialrecipe package):

[buildout]
parts = ... pyrtm ...
develop = . parts/pyrtm
eggs = pyrtm

[pyrtm]
recipe = mercurialrecipe
repository = http://bitbucket.org/srid/pyrtm

...

This does not work because sys.path does not contain the path to locally cloned mercurialrecipe (in parts/mr), and the dependencies (from parts/mr/setup.py) are not installed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

戴着白色围巾的女孩 2024-08-26 21:54:27

我发现解决这个问题的唯一方法是添加额外的路径来构建:

[buildout]
parts = ... pyrtm ...
develop = . parts/pyrtm
eggs = pyrtm

extra-paths = parts/pyrtm/src
# or wherever your pyrtm folder 
# could as well be extra-paths = pyrtm/ 
# if you your code is on same path as buildout.cfg.

[pyrtm]
recipe = mercurialrecipe
repository = http://bitbucket.org/srid/pyrtm

希望这会有所帮助。

The only way I found to go around this issue is by adding extra-paths to buildout :

[buildout]
parts = ... pyrtm ...
develop = . parts/pyrtm
eggs = pyrtm

extra-paths = parts/pyrtm/src
# or wherever your pyrtm folder 
# could as well be extra-paths = pyrtm/ 
# if you your code is on same path as buildout.cfg.

[pyrtm]
recipe = mercurialrecipe
repository = http://bitbucket.org/srid/pyrtm

Hope this helps.

无敌元气妹 2024-08-26 21:54:27

如果您可以签出/克隆存储库,那么您可以像平常一样开发 python 模块:

[buildout]
...
develop = src/Bar
eggs = Bar

If you can check out/clone the repository, then you can develop the python module as usual:

[buildout]
...
develop = src/Bar
eggs = Bar
蔚蓝源自深海 2024-08-26 21:54:27

您正在使用 Mercurial 配方对您想要用作开发蛋的 Mercurial 配方进行 Mercurial 检验...其中存在巨大的循环依赖。

构建需要善变的配方来运行“先生”部分。所以它从 pypi 获取食谱。它还不知道菜谱实际上会下载菜谱。

You're using mercurial recipe to make a mercurial checkout of the mercurial recipe that you want to use as a development egg.... There's a huge circular dependency in there.

Buildout needs the mercurial recipe to run the "mr" part. So it grabs the recipe from pypi. It doesn't yet know that the recipe will actually download the recipe.

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