SCons 作为 zc.buildout 中的鸡蛋
有没有一种简单的方法可以使用 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 很好地配合。我最终得到:
- ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/
- ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/scons-2.0 .1/
- ${buildout:目录}/eggs/scons-2.0.1-py2.6.egg/scons-2.0.1/SCons/
- ${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:
- ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/
- ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/scons-2.0.1/
- ${buildout:directory}/eggs/scons-2.0.1-py2.6.egg/scons-2.0.1/SCons/
- ${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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
天哪。我查看了 SCons 的 setup.py,它有点混乱。在 Mac 上安装时,它甚至顽固地只安装在
/usr/local
中。它当然不适合与 setuptools(以及 zc.buildout)一起使用。您可以使用
zc.recipe.command
与${buildout:executable} setup.py
一起运行 setup.py 脚本,并将其配置为安装在parts 中
subdir,然后使用一个单独的部分将所有脚本符号链接到bin/
中:因此,我们完全忽略 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 aparts
subdir, then use a separate part to symlink all the scripts intobin/
: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.