I have python project that is already built based on Scons.

I am trying to use Eclipse IDE and Pydev to fix some bugs in the source code.

I have installed Eclispe Sconsolidator plugin.

My project is like below Project A all source codes including Sconscript file which defines all the tager, environmet etc.

Eclipse provide me with Add Scons nature to the project. Once added the Scons automatically picks up my Sconscript file and executes.

== Running SCons at 10/28/13 1:59 PM ==

Command line: /opt/gcdistro/app/scons/2.3.0/bin/scons -u --jobs=16

scons: Reading SConscript files.

I want to know how can I place breakpoints in some of the .py files that is a part of my project which Scons is executing.

有帮助吗?

解决方案 2

After a bit of struggle I was able to find answer to my question. Since SCons is a python module by itself, it is possible to debug it in eclipse using PyDev. This is not the most optimal solution I wanted but was the closest.

Step 1: I disabled the Eclipse SCons nature of the project.

Step 2: Created a main file that will do the same function of SCons but instantiate the python object of the SCons main function.

Step 3: Set the breakpoints in my script where wanted and it was able to execute it.

import os
import sys

if __name__ == '__main__':
    sys.path.append('/gpfs02/gcdistro/app/scons/2.3.0/engine/')
    sys.path.append('/gpfs02/gcdistro/app/scons/2.3.0/bin/')
    sys.path.append('/gpfs02/gcdistro/app/scons/2.3.0/engine/SCons/')
    import SCons
    from SCons import Script
    Script.main()

其他提示

It may be difficult to debug a SCons project. What you have in a SConstruct or SConscript python script is only one part of a bigger picture. SCons builds in a multi-step manner, first it reads the scripts and builds its trees, then it analyzes those trees and only builds what is necessary to build. So, you'll probably only be able to debug the declarative part that is the reading of the python scripts.

Try debugging it like you would any other python program, but I doubt you'll get very far.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top