/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

(gz) Fix deprecations of win32utils path function unicode wrappers (Martin
 Packman)

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-2011 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
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
"""Bazaar -- a free distributed version-control tool"""
20
22
 
21
23
import os
23
25
import warnings
24
26
 
25
27
# update this on each release
26
 
_script_version = (2, 2, 0)
 
28
_script_version = (2, 5, 0)
27
29
 
28
30
try:
29
31
    version_info = sys.version_info
30
32
except AttributeError:
31
 
    version_info = 1, 5 # 1.5 or older
 
33
    version_info = 1, 5  # 1.5 or older
32
34
 
33
35
REINVOKE = "__BZR_REINVOKE"
34
 
NEED_VERS = (2, 4)
35
 
KNOWN_PYTHONS = ('python2.4', 'python2.5', 'python2.6')
 
36
NEED_VERS = (2, 6)
 
37
KNOWN_PYTHONS = ('python2.6', 'python2.7')
36
38
 
37
39
if version_info < NEED_VERS:
38
40
    if not os.environ.has_key(REINVOKE):
52
54
 
53
55
profiling = False
54
56
if '--profile-imports' in sys.argv:
55
 
    sys.argv.remove('--profile-imports')
56
57
    import profile_imports
57
58
    profile_imports.install()
58
59
    profiling = True
76
77
else:
77
78
    import locale
78
79
 
 
80
if os.name == "posix":
 
81
    try:
 
82
        locale.setlocale(locale.LC_ALL, '')
 
83
    except locale.Error, e:
 
84
        sys.stderr.write('bzr: warning: %s\n'
 
85
            '  bzr could not set the application locale.\n'
 
86
            '  Although this should be no problem for bzr itself, it might\n'
 
87
            '  cause problems with some plugins. To investigate the issue,\n'
 
88
            '  look at the output of the locale(1p) tool.\n' % e)
 
89
    # Use better default than ascii with posix filesystems that deal in bytes
 
90
    # natively even when the C locale or no locale at all is given. Note that
 
91
    # we need an immortal string for the hack, hence the lack of a hyphen.
 
92
    sys._bzr_default_fs_enc = "utf8"
 
93
 
79
94
 
80
95
# The python2.6 release includes some libraries that have deprecation warnings
81
96
# against the interpreter - see https://bugs.launchpad.net/bzr/+bug/387139
87
102
    )
88
103
 
89
104
 
90
 
try:
91
 
    locale.setlocale(locale.LC_ALL, '')
92
 
except locale.Error, e:
93
 
    sys.stderr.write('bzr: warning: %s\n'
94
 
                     '  bzr could not set the application locale.\n'
95
 
                     '  Although this should be no problem for bzr itself,\n'
96
 
                     '  it might cause problems with some plugins.\n'
97
 
                     '  To investigate the issue, look at the output\n'
98
 
                     '  of the locale(1p) tool available on POSIX systems.\n'
99
 
                     % e)
100
 
 
101
105
# instruct bzrlib/__init__.py to install lazy_regex
102
106
sys._bzr_lazy_regex = True
103
107
try:
110
114
    raise
111
115
 
112
116
if bzrlib.version_info[:3] != _script_version:
113
 
    sys.stderr.write("bzr: WARNING: bzrlib version doesn't match the bzr program.\n"
114
 
            "This may indicate an installation problem.\n"
115
 
            "bzrlib from %s is version %r\n"
116
 
            % (bzrlib.__path__, bzrlib.version_info))
 
117
    sys.stderr.write(
 
118
        "bzr: WARNING: bzrlib version doesn't match the bzr program.\n"
 
119
        "This may indicate an installation problem.\n"
 
120
        "bzrlib is version %s from %s\n"
 
121
        "bzr is version %s from %s\n" % (
 
122
        bzrlib._format_version_tuple(bzrlib.version_info),
 
123
        bzrlib.__path__[0],
 
124
        bzrlib._format_version_tuple(_script_version),
 
125
        __file__))
 
126
 
117
127
 
118
128
import bzrlib.inspect_for_copy
119
129
bzrlib.inspect_for_copy.import_copy_with_hacked_inspect()
135
145
 
136
146
 
137
147
if __name__ == '__main__':
138
 
    bzrlib.initialize()
139
 
    exit_val = bzrlib.commands.main()
140
 
 
141
 
    if profiling:
142
 
        profile_imports.log_stack_info(sys.stderr)
 
148
    library_state = bzrlib.initialize()
 
149
    library_state.__enter__()
 
150
    try:
 
151
        exit_val = bzrlib.commands.main()
 
152
        if profiling:
 
153
            profile_imports.log_stack_info(sys.stderr)
 
154
    finally:
 
155
        library_state.__exit__(None, None, None)
143
156
 
144
157
    # By this point we really have completed everything we want to do, and
145
158
    # there's no point doing any additional cleanup.  Abruptly exiting here