Well, in spite of the lack of any feedback I've managed to do this
myself. I can pass a file of the form:
[C:\\working\\python\\helloworld.py]
5=True
6=False
[C:\\working\\python\\test4\\goodbyeworld.py]
2=True
5=False
Where the True or False indicate if the breakpoint is enabled or
disabled.
Code is as follows:
import os
import sys
import rpdb2
from winpdb import *
import ConfigParser
if 'wx' not in sys.modules and 'wxPython' not in sys.modules:
try:
import wxversion
wxversion.ensureMinimal(WXVER)
except ImportError:
rpdb2._print(STR_WXPYTHON_ERROR_MSG, sys.__stderr__)
try:
import Tkinter
import tkMessageBox
Tkinter.Tk().wm_withdraw()
tkMessageBox.showerror(STR_WXPYTHON_ERROR_TITLE,
STR_WXPYTHON_ERROR_MSG)
except:
pass
sys.exit(1)
import wx
assert wx.VERSION_STRING >= WXVER
winpdbbp_sm = None
winpdbbp_breakpoints = {}
def callback_setbreakpoints(event):
if not winpdbbp_sm or event.m_state != rpdb2.STATE_BROKEN:
return
wx.CallAfter(callafter_setbreakpoints, event)
def callafter_setbreakpoints(event):
winpdbbp_sm.load_breakpoints()
winpdbbp_sm.delete_breakpoint([], True)
for filepath in winpdbbp_breakpoints:
linenos = winpdbbp_breakpoints[filepath]
for lineno in linenos:
enabled = linenos[lineno]
winpdbbp_sm.set_breakpoint(filepath, '', lineno, enabled,
'')
print filepath, lineno, enabled
winpdbbp_sm.remove_callback(callback_setbreakpoints)
def StartWinPDBClient(command_line, fAttach, fchdir, pwd,
fAllowUnencrypted, fRemote, host):
global winpdbbp_sm
winpdbbp_sm = rpdb2.CSessionManager(pwd, fAllowUnencrypted,
fRemote, host)
try:
app = CWinpdbApp(winpdbbp_sm, fchdir, command_line, fAttach,
fAllowUnencrypted)
except SystemError:
if
os.name == rpdb2.POSIX:
rpdb2._print(STR_X_ERROR_MSG, sys.__stderr__)
sys.exit(1)
raise
if not 'unicode' in wx.PlatformInfo:
dlg = wx.MessageDialog(None, STR_WXPYTHON_ANSI_WARNING_MSG,
STR_WXPYTHON_ANSI_WARNING_TITLE, wx.OK | wx.ICON_WARNING)
dlg.ShowModal()
dlg.Destroy()
event_type_dict = {rpdb2.CEventState: {}}
winpdbbp_sm.register_callback(callback_setbreakpoints,
event_type_dict, fSingleUse = False)
app.MainLoop()
winpdbbp_sm.shutdown()
def runwinpdb():
global winpdbbp_breakpoints
if rpdb2.get_version() != "RPDB_2_4_8":
rpdb2._print(STR_ERROR_INTERFACE_COMPATIBILITY %
("RPDB_2_4_8", rpdb2.get_version()))
return
configpath = os.path.abspath(sys.argv[1])
sys.argv = ["winpdb"] + sys.argv[2:]
print sys.argv
config = ConfigParser.ConfigParser()
config.read(configpath)
files_to_breakpoint = config.sections()
for file_to_breakpoint in files_to_breakpoint:
winpdbbp_breakpoints[file_to_breakpoint] = {}
for linenostr in config.options(file_to_breakpoint):
lineno = int(linenostr)
enabled = "True" == config.get(file_to_breakpoint,
linenostr)
winpdbbp_breakpoints[file_to_breakpoint][lineno] = enabled
return rpdb2.main(StartWinPDBClient, WINPDB_TITLE)
if __name__=='__main__':
ret = runwinpdb()
#
# Debuggee breaks (pauses) here
# before program termination.
#
# You can step to debug any exit handlers.
#
rpdb2.setbreak()