Question

I've been trying to import several packages which are actually dependencies to an egg I am building. Because these eggs are not on the cheese store, I am not able to use the install_requires = ['pack1', 'pack2'] in my setup.py script, so I am trying to add them to my buildout config the following way :

  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/

I might be doing this the wrong way - I am just starting with buildout. When I run my bin/buildout I get the following errors :

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:])

If I switch pack1 and pack2, then pack2 gets installed. Basically they both work fine, but as soon as I try to fetch both of them - it breaks everything.

Thanks in advance. Martin

Was it helpful?

Solution

I would advise you to switch to using mr.developer for external SCM-managed dependencies in a buildout. mr.developer lets you pull in dependencies (eggs or otherwise) from Mercurial repositories as well as Git, Bazaar, Darcs, Subversion and even CVS repositories. You can treat these dependencies as development eggs that other python eggs can depend on in setup.py.

To use mr.developer, add it as a buildout extension:

[buildout]
extensions = mr.developer

You tell mr.developer about resources using a [sources] section:

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

With mr.developer, you now get a command line tool to manage these repositories; you can check them out, update them, and most importantly, build them as development eggs for the buildout.

To check out such sources automatically, and have them built as development eggs, list them in the auto-checkout option in the [buildout] section:

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

When you now run buildout both pack1 and pack2 will be checked out, built as eggs, and when used as dependencies elsewhere, used to fill those dependencies. So if either 'pack1' or 'pack2' is listed on an eggs line or as a dependency of another egg in setup.py, zc.buildout will pick the versions checked out by mr.developer.

The bin/developer command line tool gives you full control over these options, please read the PyPI page for mr.developer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top