SCons 作为 zc.buildout 中的鸡蛋

发布于 2024-11-15 06:52:45 字数 1496 浏览 3 评论 0原文

有没有一种简单的方法可以使用 zc.buildout 将 SCons 安装为 Egg?我最初的想法是,既然它使用 distutils,我就可以使用 zc.recipe.egg 安装它,并认为 Egg 的设置方式是 SCons 脚本转到 ${buildout:directory}/bin 并SCons 被添加到 PYTHONPATH 中。

[buildout]
parts = 
    python

[python]
recipe = zc.recipe.egg
interpreter = mython
eggs = 
    SCons == 2.0.1

不幸的是,我认为 SCons 的 setup.py 的编写方式不能与 zc.recipe.egg 很好地配合。我最终得到:

  1. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/
  2. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/scons-2.0 .1/
  3. ${buildout:目录}/eggs/scons-2.0.1-py2.6.egg/scons-2.0.1/SCons/
  4. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/EGG-INFO/scripts/

如果 (2) 位于 PYTHONPATH 并且 (4) 的内容被复制或链接到bin 目录。

理想情况下,我想将其安装为 Egg 以利用我的全局 Egg 目录;我不想拥有同一构建工具的多个副本。是否可以使用现有的食谱来实现这个目标,或者我应该编写自己的食谱?


编辑:我制作了个人副本并修改了 SCons 的 setup.py 参数,以便创建 scons 入口点。我所做的唯一更改:删除“cmdclass”,添加“entry_points”。

arguments = {
    'name'             : "scons",
 ...
    'scripts'          : scripts,
    'entry_points'     : {
            'console_scripts':
                ['scons = SCons.Script:main']
            }
}

这种作品。它在 bin/scons 中提供了一个 scons 脚本,但没有提供 sconssign、scons-time 或 scons.bat。我把它放在 /var/www/eggs 的 tar 中并用 apache 提供服务。

[buildout]
parts = 
    python

[python]
recipe = zc.recipe.egg:scripts
interpreter = mython
eggs = 
    scons == 2.0.1
find-links = 
    http://localhost/eggs/

不确定我是否想继续朝这个方向发展。

Is there an easy way to install SCons as an egg using zc.buildout? My initial thought was that since it uses distutils I would be able to install it using zc.recipe.egg and thought that the egg would be set up in such a way that the SCons scripts go to ${buildout:directory}/bin and SCons gets added to the PYTHONPATH.

[buildout]
parts = 
    python

[python]
recipe = zc.recipe.egg
interpreter = mython
eggs = 
    SCons == 2.0.1

Unfortunately, I don't think SCons' setup.py is written in such a way that it works well with zc.recipe.egg. I end up with:

  1. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/
  2. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/scons-2.0.1/
  3. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/scons-2.0.1/SCons/
  4. ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/EGG-INFO/scripts/

This would work if (2) were on PYTHONPATH and the contents of (4) were copied or linked to the bin directory.

Ideally, I would like to install this as an egg to make use of my global eggs-directory; I don't want to have several copies of the same build tool. Is it possible to accomplish this goal using existing recipes, or should I write my own recipe?


EDIT: I made a personal copy and modified SCons' setup.py arguments so that a scons entry point will be created. The only changes I made: remove 'cmdclass', add 'entry_points'.

arguments = {
    'name'             : "scons",
 ...
    'scripts'          : scripts,
    'entry_points'     : {
            'console_scripts':
                ['scons = SCons.Script:main']
            }
}

This kind of works. It gives me a scons script in bin/scons, but not sconsign, scons-time, or scons.bat. I put it in a tar in /var/www/eggs and serve it with apache.

[buildout]
parts = 
    python

[python]
recipe = zc.recipe.egg:scripts
interpreter = mython
eggs = 
    scons == 2.0.1
find-links = 
    http://localhost/eggs/

Not sure if I want to continue in this direction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

憧憬巴黎街头的黎明 2024-11-22 06:52:45

天哪。我查看了 SCons 的 setup.py,它有点混乱。在 Mac 上安装时,它甚至顽固地只安装在 /usr/local 中。它当然不适合与 setuptools(以及 zc.buildout)一起使用。

您可以使用 zc.recipe.command${buildout:executable} setup.py 一起运行 setup.py 脚本,并将其配置为安装在 parts 中 subdir,然后使用一个单独的部分将所有脚本符号链接到 bin/ 中:

[buildout]
parts = scons

[scons-download]
recipe = gocept.download
url = http://prdownloads.sourceforge.net/scons/scons-2.0.1.tar.gz
md5sum = beca648b894cdbf85383fffc79516d18

[scons-install]
recipe = plone.recipe.command
command = ${buildout:executable} ${scons-download:location}/setup.py install --prefix=${buildout:parts-directory}/scons-install
location = ${buildout:parts-directory}/scons-install

[scons]
recipe = cns.recipe.symlink
symlink =
    scons
    scons-time
    sconsign
symlink_base = ${scons-install:location}/bin
symlink_target = ${buildout:bin-directory}

因此,我们完全忽略 setuptools,不要构建鸡蛋,而只是下载 tarball,运行手动setup.py,然后对感兴趣的部分进行符号链接。

Oh my. I looked into the setup.py for SCons, and it is a bit of a mess. It even stubbornly only installs in /usr/local when installing on a Mac. It certainly is not suitable for use with setuptools (and thus zc.buildout).

You can use zc.recipe.command to run the setup.py script with ${buildout:executable} setup.py and configure it to install in a parts subdir, then use a separate part to symlink all the scripts into bin/:

[buildout]
parts = scons

[scons-download]
recipe = gocept.download
url = http://prdownloads.sourceforge.net/scons/scons-2.0.1.tar.gz
md5sum = beca648b894cdbf85383fffc79516d18

[scons-install]
recipe = plone.recipe.command
command = ${buildout:executable} ${scons-download:location}/setup.py install --prefix=${buildout:parts-directory}/scons-install
location = ${buildout:parts-directory}/scons-install

[scons]
recipe = cns.recipe.symlink
symlink =
    scons
    scons-time
    sconsign
symlink_base = ${scons-install:location}/bin
symlink_target = ${buildout:bin-directory}

So, we ignore setuptools altogether, do not build an egg, but instead just download the tarball, run setup.py manually, then symlink the interesting parts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文