gitview: import only one of gtksourceview and gtksourceview2
Importing both gtksourceview and gtksourceview2 will make python segfault on my system (ubuntu 7.10). Change so that gtksourceview is only imported if importing gtksourceview2 fails. This should be safe as gtksourceview is only used if gtksourceview2 is not available. Signed-off-by: Anton Gyllenberg <anton@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Anton Gyllenberg committed
Nov 19, 2007 at 12:37 UTC
59adeef48fcc3ea3e1288ce62260fdd8f46240da
1 file changed
+7
-10
contrib/gitview/gitview
+7
-10
@@ -27,20 +27,17 @@ import math
27
import string
28
import fcntl
29
30
+have_gtksourceview2 = False
31
+have_gtksourceview = False
32
try:
33
import gtksourceview2
34
have_gtksourceview2 = True
35
except ImportError:
34
- have_gtksourceview2 = False
35
-
36
-try:
37
- import gtksourceview
38
- have_gtksourceview = True
39
-except ImportError:
40
- have_gtksourceview = False
41
-
42
-if not have_gtksourceview2 and not have_gtksourceview:
43
- print "Running without gtksourceview2 or gtksourceview module"
36
+ try:
37
+ import gtksourceview
38
+ have_gtksourceview = True
39
+ except ImportError:
40
+ print "Running without gtksourceview2 or gtksourceview module"
41
42
re_ident = re.compile('(author|committer) (?P<ident>.*) (?P<epoch>\d+) (?P<tz>[+-]\d{4})')
43