Skip to content
Browse files

Add support for PyDev remote debugger.

  • Loading branch information...
1 parent ad10409 commit d409bd8310ca4911a214f6d58296d7ed27bbfa3e @dieterv committed Mar 19, 2012
Showing with 45 additions and 18 deletions.
  1. +15 −6 tools/g-ir-annotation-tool.in
  2. +15 −6 tools/g-ir-doc-tool.in
  3. +15 −6 tools/g-ir-scanner.in
View
21 tools/g-ir-annotation-tool.in
@@ -23,12 +23,21 @@ import os
import sys
import __builtin__
-if 'GI_SCANNER_DEBUG' in os.environ:
- def on_exception(exctype, value, tb):
- print "Caught exception: %r %r" % (exctype, value)
- import pdb
- pdb.pm()
- sys.excepthook = on_exception
+debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
+if debug:
+ if 'pydevd' in debug:
+ # http://pydev.org/manual_adv_remote_debugger.html
+ pydevdpath = os.getenv('PYDEVDPATH', None)
+ if pydevdpath is not None and os.path.isdir(pydevdpath):
+ sys.path.insert(0, pydevdpath)
+ import pydevd
+ pydevd.settrace()
+ else:
+ def on_exception(exctype, value, tb):
+ print "Caught exception: %r %r" % (exctype, value)
+ import pdb
+ pdb.pm()
+ sys.excepthook = on_exception
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
View
21 tools/g-ir-doc-tool.in
@@ -23,12 +23,21 @@ import os
import sys
import __builtin__
-if 'GI_SCANNER_DEBUG' in os.environ:
- def on_exception(exctype, value, tb):
- print "Caught exception: %r %r" % (exctype, value)
- import pdb
- pdb.pm()
- sys.excepthook = on_exception
+debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
+if debug:
+ if 'pydevd' in debug:
+ # http://pydev.org/manual_adv_remote_debugger.html
+ pydevdpath = os.getenv('PYDEVDPATH', None)
+ if pydevdpath is not None and os.path.isdir(pydevdpath):
+ sys.path.insert(0, pydevdpath)
+ import pydevd
+ pydevd.settrace()
+ else:
+ def on_exception(exctype, value, tb):
+ print "Caught exception: %r %r" % (exctype, value)
+ import pdb
+ pdb.pm()
+ sys.excepthook = on_exception
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
View
21 tools/g-ir-scanner.in
@@ -23,12 +23,21 @@ import os
import sys
import __builtin__
-if 'GI_SCANNER_DEBUG' in os.environ:
- def on_exception(exctype, value, tb):
- print "Caught exception: %r %r" % (exctype, value)
- import pdb
- pdb.pm()
- sys.excepthook = on_exception
+debug = os.getenv('GI_SCANNER_DEBUG', '').split(',')
+if debug:
+ if 'pydevd' in debug:
+ # http://pydev.org/manual_adv_remote_debugger.html
+ pydevdpath = os.getenv('PYDEVDPATH', None)
+ if pydevdpath is not None and os.path.isdir(pydevdpath):
+ sys.path.insert(0, pydevdpath)
+ import pydevd
+ pydevd.settrace()
+ else:
+ def on_exception(exctype, value, tb):
+ print "Caught exception: %r %r" % (exctype, value)
+ import pdb
+ pdb.pm()
+ sys.excepthook = on_exception
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')

0 comments on commit d409bd8

Please sign in to comment.
Something went wrong with that request. Please try again.