Python& buildout:在配方API中获取蛋的路径

时间:2014-03-27 21:34:06

标签: python python-2.7

我正在尝试使用标准./configuremakemake install制作一个可以编译某些软件的buildout方法。 问题是我不知道如何直接在配方中获得鸡蛋的路径。

这是我食谱的一部分:

class ApacheRecipe:
  def __init__(self, buildout, name, options):
    [...]
  def install(self):
    if self.force_install:
      shutil.rmtree(self.install_path)
    if not os.path.exists(self.install_path):
      os.mkdir(self.install_path)
    egg_path = get_current_egg_path() #FIXME: how ?
    os.chdir(egg_path)
    f = os.popen('./configure')
    [...]

1 个答案:

答案 0 :(得分:0)

...您可以阅读我留给您zc.recipe.cmmi的评论中的源代码,您会在Recipe zc/recipe/cmmi/__init__.py课程中注意到以下内容>

class Recipe(object):

    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options
        directory = buildout['buildout']['directory']
        download_cache = buildout['buildout'].get('download-cache')

还要考虑阅读那里的其余代码,看看应该如何完成,例如使用tempfile来构建临时模块等。