from slapos.recipe.librecipe import GenericBaseRecipe
from zc.buildout.easy_install import working_set

class Recipe(GenericBaseRecipe):
  def __init__(self, buildout, name, options):
    self.options = options
    buildout_section = buildout['buildout']
    eggs_dir = buildout_section['eggs-directory']
    develop_eggs_dir = buildout_section['develop-eggs-directory']
    eggs = tuple(
      egg.strip()
      for egg in options['eggs'].splitlines()
      if egg.strip()
    )
    eggs_set = working_set(
      eggs,
      [develop_eggs_dir, eggs_dir]
    )

    python_path = ":".join(tuple(dist.location for dist in eggs_set))
    options['pythonpath'] = python_path
   
  def install(self): pass
  
  update = install