构建:通过 Mercurial 包含另一个 Python 项目?
我有一个名为 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 作为其版本控制系统。
实际示例:这是我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现解决这个问题的唯一方法是添加额外的路径来构建:
希望这会有所帮助。
The only way I found to go around this issue is by adding extra-paths to buildout :
Hope this helps.
如果您可以签出/克隆存储库,那么您可以像平常一样开发 python 模块:
If you can check out/clone the repository, then you can develop the python module as usual:
您正在使用 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.