2011-01-29 27 views
1

我一直在試圖導入幾個實際上依賴於我正在建設的雞蛋的軟件包。因爲這些蛋是不是在奶酪店,我無法用我nstall_requires = ['pack1', 'pack2']在我setup.py腳本,所以我想將它們添加到我的擴建配置方式如下:buildout MercurialRecipe打破多個導入

1 [buildout] 
    2 develop = . 
    3 parts = 
    4  python 
    5  pack1 
    6  pack2 
    7 
    8 extra_paths = ${pack1:location}/src/ 
    9  ${pack2:location}/src/ 
10 
11 [python] 
12 recipe = zc.recipe.egg 
13 eggs = myegg 
14 extra-paths = 
15  ${buildout:extra_paths} 
16 
17 interpreter = python 
18 
19 [pack1] 
20 recipe = mercurialrecipe 
21 repository = https://repo.xxx.com/hg/pack1/ 
22 
23 [pack2] 
24 recipe = mercurialrecipe 
25 repository = https://repo.xxx.com/hg/pack2/ 

我可能會做這是錯誤的方式 - 我剛剛開始buildout。當我運行我的bin/buildout時,出現以下錯誤:

Updating python. 
Updating pack1. 
pack1: Pulling repository https://repo.xxx.com/hg/pack1/ and updating /home/martin/proj1/parts/pack1 
pulling from https://repo.xxx.com/hg/pack1/ 
searching for changes 
no changes found 
Installing pack2. 
pack2: Cloning repository https://repo.xxx.com/hg/pack2/ to /home/martin/proj1/parts/pack2 
While: 
    Installing pack2. 

    An internal error occurred due to a bug in either zc.buildout or in a 
    recipe being used: 
    Traceback (most recent call last): 
     File "/home/martin/proj1/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1805, in main 
     getattr(buildout, command)(args) 
     File "/home/martin/proj1/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 584, in install 
     installed_files = self[part]._call(recipe.install) 
     File "/home/martin/proj1/eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/buildout.py", line 1297, in _call 
     return f() 
     File "build/bdist.linux-x86_64/egg/mercurialrecipe/__init__.py", line 50, in install 
     commands.clone(ui.ui(), get_repository(self.source), self.destination) 
     File "build/bdist.linux-x86_64/egg/mercurialrecipe/__init__.py", line 18, in get_repository 
     return hg.repository(ui.ui(), location) 
     File "/usr/lib/python2.6/site-packages/mercurial-1.7.3-py2.6-linux-x86_64.egg/mercurial/hg.py", line 96, in repository 
     repo = _lookup(path).instance(ui, path, create) 
     File "/usr/lib/python2.6/site-packages/mercurial-1.7.3-py2.6-linux-x86_64.egg/mercurial/httprepo.py", line 203, in instance 
     return statichttprepo.instance(ui, "static-" + path, create) 
     File "/usr/lib/python2.6/site-packages/mercurial-1.7.3-py2.6-linux-x86_64.egg/mercurial/statichttprepo.py", line 146, in instance 
     return statichttprepository(ui, path[7:]) 

如果我切換pack1和pack2,則會安裝pack2。基本上他們都能正常工作,但只要我嘗試把它們都取出來 - 它會打破一切。

在此先感謝。 Martin

回答

3

我建議你切換到使用mr.developer作爲外部SCM管理的依賴關係。 mr.developer允許您從Mercurial存儲庫以及Git,Bazaar,Darcs,Subversion甚至CVS存儲庫中獲取依賴項(蛋或其他)。您可以將這些依賴關係視爲其他python蛋可以在setup.py中依賴的開發蛋。

要使用mr.developer,將其添加爲擴建延伸:現在

[sources] 
pack1 = hg https://repo.xxx.com/hg/pack1/ 
pack2 = hg https://repo.xxx.com/hg/pack2/ 

隨着mr.developer,您:

[buildout] 
extensions = mr.developer 

您講述使用[sources]部分資源mr.developer獲得一個命令行工具來管理這些存儲庫;你可以檢查它們,更新它們,最重要的是,將它們作爲構建的開發雞蛋來構建。

要自動檢查出這樣的來源,以及它們建立爲發展雞蛋,在[buildout]部分auto-checkout選項一一列舉:

[buildout] 
extensions = mr.developer 
auto-checkout = 
    pack1 
    pack2 

現在,當您運行擴建兩個PACK1和PACK2將被檢查出,以雞蛋的形式構建,並在其他地方用作依賴關係時,用於填充這些依賴關係。因此,如果'pack1'或'pack2'在eggs行中列出,或者作爲setup.py中另一個egg的依賴關係,zc.buildout將選擇由mr.developer檢出的版本。

使用命令行工具bin/developer可以完全控制這些選項,請閱讀PyPI page for mr.developer

+0

非常感謝Martjin。我已經轉到mr.developer,它的功能就像一個魅力。您介意解釋如何將pack1列爲setup.py中的依賴項嗎?我設法在setup.py中列出了位於奶酪店的雞蛋的依賴關係,但不是位於別處的雞蛋。再次感謝Martjin – Martin 2011-01-30 21:12:14