~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Sidnei da Silva
  • Date: 2009-05-29 14:19:29 UTC
  • mto: (4531.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4532.
  • Revision ID: sidnei.da.silva@canonical.com-20090529141929-3heywbvj36po72a5
- Add initial config

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
20
20
 
21
21
import os
22
22
import sys
23
 
import warnings
24
23
 
25
24
# update this on each release
26
 
_script_version = (2, 2, 0)
 
25
_script_version = (1, 16, 0)
27
26
 
 
27
if __doc__ is None:
 
28
    print "bzr does not support python -OO."
 
29
    sys.exit(2)
28
30
try:
29
31
    version_info = sys.version_info
30
32
except AttributeError:
32
34
 
33
35
REINVOKE = "__BZR_REINVOKE"
34
36
NEED_VERS = (2, 4)
35
 
KNOWN_PYTHONS = ('python2.4', 'python2.5', 'python2.6')
 
37
KNOWN_PYTHONS = ('python2.4', 'python2.5')
36
38
 
37
39
if version_info < NEED_VERS:
38
40
    if not os.environ.has_key(REINVOKE):
76
78
else:
77
79
    import locale
78
80
 
79
 
 
80
 
# The python2.6 release includes some libraries that have deprecation warnings
81
 
# against the interpreter - see https://bugs.launchpad.net/bzr/+bug/387139
82
 
warnings.filterwarnings('ignore',
83
 
    r"(struct integer overflow masking is deprecated|"
84
 
    r"'L' format requires 0 <= number <= 4294967295)",
85
 
    DeprecationWarning,
86
 
    'gzip',
87
 
    )
88
 
 
89
 
 
90
81
try:
91
82
    locale.setlocale(locale.LC_ALL, '')
92
83
except locale.Error, e:
119
110
bzrlib.inspect_for_copy.import_copy_with_hacked_inspect()
120
111
 
121
112
import bzrlib.breakin
122
 
bzrlib.breakin.hook_debugger_to_signal()
 
113
bzrlib.breakin.hook_sigquit()
123
114
 
124
115
import bzrlib.decorators
125
116
if ('--lsprof' in sys.argv
135
126
 
136
127
 
137
128
if __name__ == '__main__':
138
 
    bzrlib.initialize()
 
129
    bzrlib.trace.enable_default_logging()
139
130
    exit_val = bzrlib.commands.main()
140
131
 
141
132
    if profiling:
142
133
        profile_imports.log_stack_info(sys.stderr)
143
134
 
 
135
    # run anything registered by atexit, because it won't be run in the normal
 
136
    # way
 
137
    sys.exitfunc()
 
138
 
144
139
    # By this point we really have completed everything we want to do, and
145
140
    # there's no point doing any additional cleanup.  Abruptly exiting here
146
141
    # stops any background threads getting into trouble as code is unloaded,
148
143
    # are just about to be discarded anyhow.  This does mean that atexit hooks
149
144
    # won't run but we don't use them.  Also file buffers won't be flushed,
150
145
    # but our policy is to always close files from a finally block. -- mbp 20070215
151
 
    sys.exitfunc()
 
146
    try:
 
147
        sys.stdout.flush()
 
148
        sys.stderr.flush()
 
149
    except IOError, e:
 
150
        import errno
 
151
        if e.errno in [errno.EINVAL, errno.EPIPE]:
 
152
            pass
 
153
        else:
 
154
            raise
 
155
    if bzrlib.trace._trace_file:
 
156
        # this is also _bzr_log
 
157
        bzrlib.trace._trace_file.flush()
152
158
    os._exit(exit_val)
153
159
else:
154
160
    raise ImportError("The bzr script cannot be imported.")