/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 bzr

  • Committer: Martin Pool
  • Date: 2010-01-06 04:48:59 UTC
  • mto: This revision was merged to the branch mainline in revision 4943.
  • Revision ID: mbp@sourcefrog.net-20100106044859-s8gwd12nev9p7nws
Rename Server.tearDown to .stop_server

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, 1, 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:
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.")