~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Ian Clatworthy
  • Date: 2009-09-09 00:49:50 UTC
  • mto: (4634.37.2 prepare-2.0)
  • mto: This revision was merged to the branch mainline in revision 4689.
  • Revision ID: ian.clatworthy@canonical.com-20090909004950-43z4zdicb5u91iet
tweak quick reference naming to make it consistent with other PDFs

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 = (2, 0, 0)
27
27
 
28
28
if __doc__ is None:
29
29
    print "bzr does not support python -OO."
138
138
 
139
139
 
140
140
if __name__ == '__main__':
141
 
    bzrlib.initialize()
 
141
    bzrlib.trace.enable_default_logging()
142
142
    exit_val = bzrlib.commands.main()
143
143
 
144
144
    if profiling:
145
145
        profile_imports.log_stack_info(sys.stderr)
146
146
 
 
147
    # run anything registered by atexit, because it won't be run in the normal
 
148
    # way
 
149
    sys.exitfunc()
 
150
 
147
151
    # By this point we really have completed everything we want to do, and
148
152
    # there's no point doing any additional cleanup.  Abruptly exiting here
149
153
    # stops any background threads getting into trouble as code is unloaded,
151
155
    # are just about to be discarded anyhow.  This does mean that atexit hooks
152
156
    # won't run but we don't use them.  Also file buffers won't be flushed,
153
157
    # but our policy is to always close files from a finally block. -- mbp 20070215
154
 
    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()
155
170
    os._exit(exit_val)
156
171
else:
157
172
    raise ImportError("The bzr script cannot be imported.")