1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#! /usr/bin/env python3
# Copyright (C) 2005-2013, 2016, 2017 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
from __future__ import absolute_import
"""Breezy -- a free distributed version-control tool"""
import os
import sys
import warnings
# update this on each release
_script_version = (3, 1, 0)
NEED_VERS = (2, 7)
if sys.version_info < NEED_VERS:
sys.stderr.write("brz: error: cannot find a suitable python interpreter\n")
sys.stderr.write(" (need %d.%d or later)\n" % NEED_VERS)
sys.exit(1)
profiling = False
if '--profile-imports' in sys.argv:
import profile_imports
profile_imports.install()
profiling = True
if os.name == "posix":
import locale
try:
locale.setlocale(locale.LC_ALL, '')
except locale.Error as e:
sys.stderr.write(
'brz: warning: %s\n'
' bzr could not set the application locale.\n'
' Although this should be no problem for bzr itself, it might\n'
' cause problems with some plugins. To investigate the issue,\n'
' look at the output of the locale(1p) tool.\n' % e)
# Use better default than ascii with posix filesystems that deal in bytes
# natively even when the C locale or no locale at all is given. Note that
# we need an immortal string for the hack, hence the lack of a hyphen.
sys._brz_default_fs_enc = "utf8"
try:
import breezy
except ImportError as e:
sys.stderr.write(
"brz: ERROR: "
"Couldn't import breezy and dependencies.\n"
"Please check the directory containing breezy is on your PYTHONPATH.\n"
"\n")
raise
if breezy.version_info[:3] != _script_version:
sys.stderr.write(
"brz: WARNING: breezy version doesn't match the brz program.\n"
"This may indicate an installation problem.\n"
"breezy is version %s from %s\n"
"brz is version %s from %s\n" % (
breezy._format_version_tuple(breezy.version_info),
breezy.__path__[0],
breezy._format_version_tuple(_script_version),
__file__))
if __name__ == '__main__':
from breezy.__main__ import main
main()
else:
raise ImportError("The brz script cannot be imported.")
|