~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Martin Pool
  • Date: 2005-05-10 07:06:05 UTC
  • Revision ID: mbp@sourcefrog.net-20050510070605-0a2453ae5db6fc3c
- new command 'bzr added'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
 
 
3
# Copyright (C) 2004, 2005 by Martin Pool
3
4
# Copyright (C) 2005 by Canonical Ltd
4
5
 
5
6
# This program is free software; you can redistribute it and/or modify
16
17
# along with this program; if not, write to the Free Software
17
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19
 
19
 
import os, sys
20
 
 
21
 
try:
22
 
    version_info = sys.version_info
23
 
except AttributeError:
24
 
    version_info = 1, 5 # 1.5 or older
25
 
 
26
 
 
27
 
REINVOKE = "__BZR_REINVOKE"    
28
 
NEED_VERS = (2, 3)
29
 
 
30
 
if version_info < NEED_VERS:
31
 
    if not os.environ.has_key(REINVOKE):
32
 
        # mutating os.environ doesn't work in old Pythons
33
 
        os.putenv(REINVOKE, "1")
34
 
        for python in 'python2.4', 'python2.3':
35
 
            try:
36
 
                os.execvp(python, [python] + sys.argv)
37
 
            except OSError:
38
 
                pass
39
 
    print >>sys.stderr, "bzr: error: cannot find a suitable python interpreter"
40
 
    print >>sys.stderr, "  (need %d.%d or later)" % NEED_VERS
41
 
    sys.exit(1)
42
 
os.unsetenv(REINVOKE)
43
 
 
44
 
import bzrlib, bzrlib.commands
 
20
import sys, bzrlib, bzrlib.commands
 
21
 
45
22
 
46
23
if __name__ == '__main__':
47
24
    sys.exit(bzrlib.commands.main(sys.argv))
 
25