如何使用 eclipse 和 pydev 调试 SCons 脚本?

发布于 2024-07-25 14:22:34 字数 122 浏览 6 评论 0原文

我是 SCons 的新手,也在使用 pydev。 有人可以帮助我指导如何使用 Eclipse 和 pydev 调试 scons 脚本吗? 考虑到 SCons 是一个单独的应用程序而不是 python 的扩展这一事实是否有可能?

I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?

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

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

发布评论

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

评论(6

梦在夏天 2024-08-01 14:22:34

你是对的。 由于 SCons 基于 Python,因此可以通过 EClipse PyDev 调试 SCons 脚本。 为此,您需要在调试配置中执行以下操作...

  • 1. 在 main 选项卡下,将主模块设置为 SCons 文件,如果您已安装 SCons,该文件将在 python/scripts 目录下可用。 如果您尚未运行 SCons 的安装,您可以指向 SCons 目录下的此文件。
  • 2. 在参数选项卡下,将工作目录设置为项目的根目录。

    现在在 SConstruct 或 SConcript 上设置断点并在调试模式下运行。 就这样!!
    通过这种方法,您不仅可以调试产品代码,还可以调试构建产品的构建脚本:-) 调试愉快!!!!

  • You are right. Since the SCons is python based, the SCons scripts are debuggable via EClipse PyDev. For this, you need to do the following in the debug configuration...

  • 1. Under the main tab, set the main module to the SCons file which will be available under the python/scripts directory if you have installed SCons. If you have not run the install of SCons you can point to this file under the SCons directory.
  • 2. Under the arguments tab, set the working directory to the root of your project.

    Now set the breakpoint either on SConstruct or SConcript and run in debug mode. That's all!!
    With this approach you can not only debug your product code but also the build scripts that builds your product :-) Happy Debugging!!!!

  • 來不及說愛妳 2024-08-01 14:22:34

    我不是 Eclipse 专家,但由于您没有得到任何其他答案...

    如果您将 SCons 源作为 Eclipse 项目的一部分,并从 Eclipse 中运行整个命令,它应该像任何 Eclipse 调试一样工作。 SCons 是用 Python 编写的,没有理由不能像其他东西一样在 Eclipse 中调试它。

    I'm not an Eclipse expert, but since you didn't get any other answer...

    If you make the SCons source a part of the Eclipse project, and run the whole command from within Eclipse it should work like any Eclipse debugging. SCons is written in Python, there is no reason it shouldn't be debuggable in Eclipse just like anything else.

    雨落星ぅ辰 2024-08-01 14:22:34

    如果您使用 SCons 进行 C/C++ 开发和 Eclipse CDT,请查看 http://sconsolidator.com(在接下来的几周内) ),我们将很快发布我们的 SCons Eclipse 插件以供免费公众使用。 它还包含一个“交互模式”,允许 SCons 构建运行得更快(无启动时间),并且还可以在控制台中调试 SCons。 然而,使用 PyDev 的技巧仍然适用(可以与 CDT 一起安装在同一个 Eclipse 实例中。

    if you are using SCons for C/C++ development and Eclipse CDT check out http://sconsolidator.com (within the next weeks), we will release our SCons Eclipse plug-in for free public use shortly. It also contains an "interactive mode" that allows SCons builds to run more quickly (no startup time) and also to debug SCons in a console. However, the tip with using PyDev still applies (can be installed alongside with CDT in the same Eclipse instance.

    呆头 2024-08-01 14:22:34

    在 MAC 上通过 pydev 调试 scons 遵循 Lennart 的答案,但只需添加一个即可。

    使用 Finder(或终端)浏览到 scons 的安装位置。 您可以使用“which”命令找到它。

    例如哪个scons
    -> /usr/local/bin/scons

    制作 scons 文件的副本并将其命名为 scons.py。

    现在,当您在 Eclipse 中创建调试配置时,请使用 scons.py 作为“主模块”。

    PS:要将 scons 项目添加到 Eclipse,我发现使用指向 /usr/local/bin/ 的“链接文件夹”更容易。 即因为我在尝试添加目录本身时遇到只读错误。

    On MAC to debug scons through pydev follow Lennart's answer but with one simply addition.

    Using Finder (or terminal) browse to where scons is installed. You can find this with the "which" command.

    e.g. which scons
    -> /usr/local/bin/scons

    Make a copy of the scons file and call it scons.py.

    Now when you create the Debug Configuration in Eclipse use scons.py as the "Main Module".

    PS: To add a scons project to Eclipse I found it easier to use a "Linked Folder" pointing at /usr/local/bin/. i.e. Because I was getting a read-only error when trying to add the directory itself.

    被你宠の有点坏 2024-08-01 14:22:34

    从那时起,我获得了更多 SCons / Python 的经验,我建议使用 python 的 pdb 模块。 要使用它,只需将以下代码添加到您的 SCons/Python 文件中。

    导入pdb; pdb.set_trace()

    当从命令行运行文件时,将在此行命中断点。 我也离开了 Eclipse。 轻量级编辑器同样适合 Python 开发。 我用的是崇高。

    I've since gain more experience with SCons / Python and I'd recommend using python's pdb module. To use it simply add the following code to your SCons/Python files.

    import pdb; pdb.set_trace()

    When the file is run from the command line a breakpoint will be hit at this line. I also moved away from Eclipse. A lightweight editor will be just as good for Python development. I use Sublime.

    青丝拂面 2024-08-01 14:22:34

    作为附录:在 Windows 上,我必须将 scons 安装的文件复制到 C:\Python27\Lib\site-packages\scons 下才能使其正常工作。 将原始安装位置(用版本号限定)添加到 PYTHONPATH 中不起作用。

    As an addendum: on Windows, I had to copy the scons-installed files to reside under C:\Python27\Lib\site-packages\scons in order for this to work. Adding the original installed location, qualified with the version number, to the PYTHONPATH, did not work.

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