Release 0.19
[stgit.git] / stg-dbg
bloba6302cf632f539c2675f4820976f120be0b994e5
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # -*- python-mode -*-
4 """Run stg with the pdb debugger."""
5 from __future__ import (absolute_import, division, print_function,
6 unicode_literals)
7 import os
8 import pdb
9 import sys
11 __copyright__ = """
12 Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License version 2 as
16 published by the Free Software Foundation.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see http://www.gnu.org/licenses/.
25 """
27 if __name__ == '__main__':
28 # Try to detect where it is run from and set prefix and the search path.
29 # It is assumed that the user installed StGIT using the --prefix= option
30 prefix, bin = os.path.split(sys.path[0])
32 if bin == 'bin' and prefix != sys.prefix:
33 sys.prefix = prefix
34 sys.exec_prefix = prefix
36 major, minor = sys.version_info[0:2]
37 local_path = [
38 os.path.join(prefix, 'lib', 'python'),
39 os.path.join(prefix, 'lib', 'python%s.%s' % (major, minor)),
40 os.path.join(prefix, 'lib', 'python%s.%s' % (major, minor),
41 'site-packages')]
42 sys.path = local_path + sys.path
44 from stgit.main import main # noqa
46 pdb.run('main()')