File: gquilt

package info (click to toggle)
gquilt 0.25-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 596 kB
  • sloc: python: 6,306; makefile: 36; sh: 23
file content (64 lines) | stat: -rwxr-xr-x 1,798 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
### Copyright (C) 2010 Peter Williams <peter_ono@users.sourceforge.net>

### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; version 2 of the License only.

### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.

### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"""Launch a GUI wrapper for quilt and Mercurial Queues (mq) patch management tools"""

import sys
import os
import getopt

import gtk

from gquilt_pkg import dialogue
try:
    from gquilt_pkg import gquilt
except Exception:
    dialogue.report_exception(sys.exc_info())
    sys.exit(3)

def usage():
    """Print the program's usage message"""
    print("Usage: gquilt [dir]")

# read required directory from the command line
try:
    OPTION_LIST, ARG_LIST = getopt.getopt(sys.argv[1:], "")
except getopt.GetoptError as err:
    sys.stderr.write(str(err) + os.linesep)
    usage()
    sys.exit(1)

if len(ARG_LIST) > 1:
    usage()
    sys.exit(1)

DIR_SPECIFIED = len(ARG_LIST) == 1

if DIR_SPECIFIED:
    try:
        os.chdir(sys.argv[1])
    except OSError as msg:
        sys.stderr.write(str(msg) + os.linesep)
        sys.exit(2)

try:
    gquilt.GQuilt(DIR_SPECIFIED).show()
    gtk.main()
except (SystemExit, KeyboardInterrupt):
    pass
except Exception:
    dialogue.report_exception(sys.exc_info())
    sys.exit(3)