/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/crash.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
import pprint
50
50
import sys
51
51
import time
52
 
from StringIO import StringIO
53
52
 
54
53
import breezy
55
 
from breezy import (
 
54
from . import (
56
55
    config,
57
56
    debug,
58
57
    osutils,
59
58
    plugin,
60
59
    trace,
61
60
    )
 
61
from .sixish import (
 
62
    StringIO,
 
63
    )
62
64
 
63
65
 
64
66
def report_bug(exc_info, stderr):
69
71
        if report_bug_to_apport(exc_info, stderr):
70
72
            # wrote a file; if None then report the old way
71
73
            return
72
 
    except ImportError, e:
 
74
    except ImportError as e:
73
75
        trace.mutter("couldn't find apport bug-reporting library: %s" % e)
74
 
    except Exception, e:
 
76
    except Exception as e:
75
77
        # this should only happen if apport is installed but it didn't
76
78
        # work, eg because of an io error writing the crash file
77
79
        trace.mutter("bzr: failed to report crash using apport: %r" % e)
225
227
def _attach_log_tail(pr):
226
228
    try:
227
229
        bzr_log = open(trace._get_bzr_log_filename(), 'rt')
228
 
    except (IOError, OSError), e:
 
230
    except (IOError, OSError) as e:
229
231
        pr['BzrLogTail'] = repr(e)
230
232
        return
231
233
    try:
241
243
        # on unix this should be /var/crash and should already exist; on
242
244
        # Windows or if it's manually configured it might need to be created,
243
245
        # and then it should be private
244
 
        os.makedirs(crash_dir, mode=0600)
 
246
        os.makedirs(crash_dir, mode=0o600)
245
247
    date_string = time.strftime('%Y-%m-%dT%H:%M', osutils.gmtime())
246
248
    # XXX: getuid doesn't work on win32, but the crash directory is per-user
247
249
    if sys.platform == 'win32':
258
260
    return filename, os.fdopen(
259
261
        os.open(filename, 
260
262
            os.O_WRONLY|os.O_CREAT|os.O_EXCL,
261
 
            0600),
 
263
            0o600),
262
264
        'wb')
263
265
 
264
266