~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:56:05 UTC
  • mfrom: (6615.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201195605-o7rl92wf6uyum3fk
(vila) Open trunk again as 2.8b1 (Vincent Ladeuil)

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-2013, 2016 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, 3, 0)
27
 
 
28
 
try:
29
 
    version_info = sys.version_info
30
 
except AttributeError:
31
 
    version_info = 1, 5 # 1.5 or older
32
 
 
33
 
REINVOKE = "__BZR_REINVOKE"
34
 
NEED_VERS = (2, 4)
35
 
KNOWN_PYTHONS = ('python2.4', 'python2.5', 'python2.6')
36
 
 
37
 
if version_info < NEED_VERS:
38
 
    if not os.environ.has_key(REINVOKE):
39
 
        # mutating os.environ doesn't work in old Pythons
40
 
        os.putenv(REINVOKE, "1")
41
 
        for python in KNOWN_PYTHONS:
42
 
            try:
43
 
                os.execvp(python, [python] + sys.argv)
44
 
            except OSError:
45
 
                pass
 
28
_script_version = (2, 8, 0)
 
29
 
 
30
NEED_VERS = (2, 6)
 
31
 
 
32
if sys.version_info < NEED_VERS:
46
33
    sys.stderr.write("bzr: error: cannot find a suitable python interpreter\n")
47
34
    sys.stderr.write("  (need %d.%d or later)\n" % NEED_VERS)
48
35
    sys.exit(1)
49
 
if hasattr(os, "unsetenv"):
50
 
    os.unsetenv(REINVOKE)
51
36
 
52
37
 
53
38
profiling = False
56
41
    profile_imports.install()
57
42
    profiling = True
58
43
 
59
 
if sys.platform == 'darwin':
60
 
    # jameinel says this hack is to force python to honor the LANG setting,
61
 
    # even on Darwin.  Otherwise it is apparently hardcoded to Mac-Roman,
62
 
    # which is incorrect for the normal Terminal.app which wants UTF-8.
63
 
    #
64
 
    # "It might be that I should be setting the "system locale" somewhere else
65
 
    # on the system, rather than setting LANG=en_US.UTF-8 in .bashrc.
66
 
    # Switching to 'posix' and setting LANG worked for me."
67
 
    #
68
 
    # So we can remove this if someone works out the right way to tell Mac
69
 
    # Python which encoding to use.  -- mbp 20080703
70
 
    sys.platform = 'posix'
71
 
    try:
72
 
        import locale
73
 
    finally:
74
 
        sys.platform = 'darwin'
75
 
else:
 
44
 
 
45
if os.name == "posix":
76
46
    import locale
 
47
    try:
 
48
        locale.setlocale(locale.LC_ALL, '')
 
49
    except locale.Error, e:
 
50
        sys.stderr.write('bzr: warning: %s\n'
 
51
            '  bzr could not set the application locale.\n'
 
52
            '  Although this should be no problem for bzr itself, it might\n'
 
53
            '  cause problems with some plugins. To investigate the issue,\n'
 
54
            '  look at the output of the locale(1p) tool.\n' % e)
 
55
    # Use better default than ascii with posix filesystems that deal in bytes
 
56
    # natively even when the C locale or no locale at all is given. Note that
 
57
    # we need an immortal string for the hack, hence the lack of a hyphen.
 
58
    sys._bzr_default_fs_enc = "utf8"
77
59
 
78
60
 
79
61
# The python2.6 release includes some libraries that have deprecation warnings
86
68
    )
87
69
 
88
70
 
89
 
try:
90
 
    locale.setlocale(locale.LC_ALL, '')
91
 
except locale.Error, e:
92
 
    sys.stderr.write('bzr: warning: %s\n'
93
 
                     '  bzr could not set the application locale.\n'
94
 
                     '  Although this should be no problem for bzr itself,\n'
95
 
                     '  it might cause problems with some plugins.\n'
96
 
                     '  To investigate the issue, look at the output\n'
97
 
                     '  of the locale(1p) tool available on POSIX systems.\n'
98
 
                     % e)
99
 
 
100
71
# instruct bzrlib/__init__.py to install lazy_regex
101
72
sys._bzr_lazy_regex = True
102
73
try:
109
80
    raise
110
81
 
111
82
if bzrlib.version_info[:3] != _script_version:
112
 
    sys.stderr.write("bzr: WARNING: bzrlib version doesn't match the bzr program.\n"
113
 
            "This may indicate an installation problem.\n"
114
 
            "bzrlib from %s is version %r\n"
115
 
            % (bzrlib.__path__, bzrlib.version_info))
 
83
    sys.stderr.write(
 
84
        "bzr: WARNING: bzrlib version doesn't match the bzr program.\n"
 
85
        "This may indicate an installation problem.\n"
 
86
        "bzrlib is version %s from %s\n"
 
87
        "bzr is version %s from %s\n" % (
 
88
        bzrlib._format_version_tuple(bzrlib.version_info),
 
89
        bzrlib.__path__[0],
 
90
        bzrlib._format_version_tuple(_script_version),
 
91
        __file__))
 
92
 
116
93
 
117
94
import bzrlib.inspect_for_copy
118
95
bzrlib.inspect_for_copy.import_copy_with_hacked_inspect()