/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

merge permissions branch, also fixup tests so they are lined up with bzr.dev to help prevent conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
 
 
3
# Copyright (C) 2005 by Canonical Ltd
 
4
 
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; either version 2 of the License, or
 
8
# (at your option) any later version.
 
9
 
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
 
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program; if not, write to the Free Software
 
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
"""Bazaar-NG -- a free distributed version-control tool"""
 
19
import os, sys
 
20
if __doc__ is None:
 
21
    print "bzr does not support python -OO."
 
22
    sys.exit(2)
 
23
try:
 
24
    version_info = sys.version_info
 
25
except AttributeError:
 
26
    version_info = 1, 5 # 1.5 or older
 
27
 
 
28
REINVOKE = "__BZR_REINVOKE"
 
29
NEED_VERS = (2, 4)
 
30
KNOWN_PYTHONS = ('python2.4',)
 
31
 
 
32
if version_info < NEED_VERS:
 
33
    if not os.environ.has_key(REINVOKE):
 
34
        # mutating os.environ doesn't work in old Pythons
 
35
        os.putenv(REINVOKE, "1")
 
36
        for python in KNOWN_PYTHONS:
 
37
            try:
 
38
                os.execvp(python, [python] + sys.argv)
 
39
            except OSError:
 
40
                pass
 
41
    print >>sys.stderr, "bzr: error: cannot find a suitable python interpreter"
 
42
    print >>sys.stderr, "  (need %d.%d or later)" % NEED_VERS
 
43
    sys.exit(1)
 
44
if hasattr(os, "unsetenv"):
 
45
    os.unsetenv(REINVOKE)
 
46
 
 
47
try:
 
48
    import bzrlib
 
49
    import bzrlib.commands
 
50
    import bzrlib.trace
 
51
except ImportError, e:
 
52
    sys.stderr.write("bzr: ERROR: "
 
53
                     "Couldn't import bzrlib and dependencies.\n"
 
54
                     "Please check bzrlib is on your PYTHONPATH.\n"
 
55
                     "\n")
 
56
    raise
 
57
 
 
58
if bzrlib.version_info[:3] != (0, 7, 0):
 
59
    sys.stderr.write("bzr: WARNING: bzrlib version doesn't match the bzr program.\n"
 
60
            "This may indicate an installation problem.\n"
 
61
            "bzrlib from %s is version %r\n"
 
62
            % (bzrlib.__path__, bzrlib.version_info))
 
63
 
 
64
if __name__ == '__main__':
 
65
    bzrlib.trace.enable_default_logging()
 
66
    sys.exit(bzrlib.commands.main(sys.argv))
 
67
else:
 
68
    pass    # should this give an error? - it can't be used as a lib