~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Jelmer Vernooij
  • Date: 2012-01-05 16:03:11 UTC
  • mfrom: (6432 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6433.
  • Revision ID: jelmer@samba.org-20120105160311-12o5p67kin1v3zps
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
25
27
# update this on each release
26
28
_script_version = (2, 5, 0)
27
29
 
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
30
NEED_VERS = (2, 6)
35
 
KNOWN_PYTHONS = ('python2.6', 'python2.7')
36
31
 
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
 
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
77
 
 
78
 
if os.name == "posix":
79
47
    try:
80
48
        locale.setlocale(locale.LC_ALL, '')
81
49
    except locale.Error, e: