~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: John Arbash Meinel
  • Date: 2009-07-31 16:51:48 UTC
  • mto: This revision was merged to the branch mainline in revision 4611.
  • Revision ID: john@arbash-meinel.com-20090731165148-fg37wo885ppjp4we
Fix the direct lock tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
 
3
 
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
 
3
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
4
4
#
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
23
23
import warnings
24
24
 
25
25
# update this on each release
26
 
_script_version = (2, 2, 0)
 
26
_script_version = (1, 18, 0)
27
27
 
 
28
if __doc__ is None:
 
29
    print "bzr does not support python -OO."
 
30
    sys.exit(2)
28
31
try:
29
32
    version_info = sys.version_info
30
33
except AttributeError:
119
122
bzrlib.inspect_for_copy.import_copy_with_hacked_inspect()
120
123
 
121
124
import bzrlib.breakin
122
 
bzrlib.breakin.hook_debugger_to_signal()
 
125
bzrlib.breakin.hook_sigquit()
123
126
 
124
127
import bzrlib.decorators
125
128
if ('--lsprof' in sys.argv
135
138
 
136
139
 
137
140
if __name__ == '__main__':
138
 
    bzrlib.initialize()
 
141
    bzrlib.trace.enable_default_logging()
139
142
    exit_val = bzrlib.commands.main()
140
143
 
141
144
    if profiling:
142
145
        profile_imports.log_stack_info(sys.stderr)
143
146
 
 
147
    # run anything registered by atexit, because it won't be run in the normal
 
148
    # way
 
149
    sys.exitfunc()
 
150
 
144
151
    # By this point we really have completed everything we want to do, and
145
152
    # there's no point doing any additional cleanup.  Abruptly exiting here
146
153
    # stops any background threads getting into trouble as code is unloaded,
148
155
    # are just about to be discarded anyhow.  This does mean that atexit hooks
149
156
    # won't run but we don't use them.  Also file buffers won't be flushed,
150
157
    # but our policy is to always close files from a finally block. -- mbp 20070215
151
 
    sys.exitfunc()
 
158
    try:
 
159
        sys.stdout.flush()
 
160
        sys.stderr.flush()
 
161
    except IOError, e:
 
162
        import errno
 
163
        if e.errno in [errno.EINVAL, errno.EPIPE]:
 
164
            pass
 
165
        else:
 
166
            raise
 
167
    if bzrlib.trace._trace_file:
 
168
        # this is also _bzr_log
 
169
        bzrlib.trace._trace_file.flush()
152
170
    os._exit(exit_val)
153
171
else:
154
172
    raise ImportError("The bzr script cannot be imported.")