简体   繁体   English

如何使用buildout从回购中提取python包?

[英]How to pull a python package from a repo using buildout?

I have a pre-rolled bootstrap script that creates a buildout.cfg for my wsgi-based framework. 我有一个预启动的引导脚本,该脚本为基于wsgi的框架创建buildout.cfg。 Buildout is run with this initially to create the necessary paste directory structure. 最初使用Buildout运行此操作,以创建必要的粘贴目录结构。 I then pull my code from the VCS repo into the src directory, and a buildout.cfg specific to whatever env I'm deploying to along with a few other .py static data files. 然后,我将代码从VCS存储库中提取到src目录中,并将一个buildout.cfg特定于我要部署到的环境以及其他一些.py静态数据文件。 Then I run buildout again. 然后,我再次运行扩展。

Running buildout twice is pretty wasteful from my pov. 从我的观点来看,两次运行扩展都是很浪费的。 Is there a way to do an export from subversion from within buildout into my project source dir and also arbitrary files? 有没有一种方法可以从构建版本中的Subversion导出到项目源目录以及任意文件中?

I'd use mr.developer to grab a local checkout: 我会使用mr.developer来进行本地结帐:

[buildout]
extensions = mr.developer
auto-checkout = yourpackage

[sources]
yourpackage = svn http://url.to/repository

Now mr.developer will check out yourpackage as part of the buildout run, into src/ , run it's setup.py to make it a development egg, and tell buildout it's available as such. 现在, mr.developer会在yourpackage运行的一部分中将您的yourpackagesrc/ ,运行setup.py使其成为开发工具,并告知构建它本身可用。 Now buildout will use that local copy to satisfy any yourpackage requirement. 现在buildout将使用该本地副本来满足您的yourpackage要求。

If your svn package is not a python egg, simply add egg=false to it's sources entry, and mr.developer won't look for a setup.py to run. 如果您的svn软件包不是python egg,只需在其sources条目中添加egg=falsemr.developer不会寻找setup.py来运行。

Alternatively, you can just use iw.recipe.cmd to simply run the svn command: 另外,您可以只使用iw.recipe.cmd来简单地运行svn命令:

[yourpackage]
recipe = iw.recipe.cmd
cmds = 
   svn export http://url.to/repository

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM