Remove some unused imports.
[cvs2svn.git] / cvs2bzr
blob5e5b037aa4d12044931da56c67ebd0d3fffef860
1 #!/usr/bin/env python
2 # (Be in -*- python -*- mode.)
4 # ====================================================================
5 # Copyright (c) 2000-2009 CollabNet. All rights reserved.
7 # This software is licensed as described in the file COPYING, which
8 # you should have received as part of this distribution. The terms
9 # are also available at http://subversion.tigris.org/license-1.html.
10 # If newer versions of this license are posted there, you may use a
11 # newer version instead, at your option.
13 # This software consists of voluntary contributions made by many
14 # individuals. For exact contribution history, see the revision
15 # history and logs, available at http://cvs2svn.tigris.org/.
16 # ====================================================================
18 import sys
20 # Make sure that a supported version of Python is being used. Do this
21 # as early as possible, using only code compatible with Python 1.5.2
22 # and Python 3.x before the check. Remember:
24 # Python 1.5.2 doesn't have sys.version_info or ''.join().
25 # Python 3.0 doesn't have string.join().
26 # There are plans to start deprecating the string formatting '%'
27 # operator in Python 3.1 (but we use it here anyway).
29 version_error = """\
30 ERROR: cvs2bzr requires Python 2, version 2.4 or later; it does not
31 work with Python 3. You are currently using"""
33 version_advice = """\
34 Please restart cvs2bzr using a different version of the Python
35 interpreter. Visit http://www.python.org or consult your local system
36 administrator if you need help.
38 HINT: If you already have a usable Python version installed, it might
39 be possible to invoke cvs2bzr with the correct Python interpreter by
40 typing something like 'python2.5 """ + sys.argv[0] + """ [...]'.
41 """
43 try:
44 version = sys.version_info
45 except AttributeError:
46 # This is probably a pre-2.0 version of Python.
47 sys.stderr.write(version_error + '\n')
48 sys.stderr.write('-'*70 + '\n')
49 sys.stderr.write(sys.version + '\n')
50 sys.stderr.write('-'*70 + '\n')
51 sys.stderr.write(version_advice)
52 sys.exit(1)
54 if not ((2,4) <= version < (3,0)):
55 sys.stderr.write(
56 version_error + ' version %d.%d.%d.\n'
57 % (version[0], version[1], version[2],)
59 sys.stderr.write(version_advice)
60 sys.exit(1)
63 import os
65 from cvs2svn_lib.common import FatalException
66 from cvs2svn_lib.main import bzr_main
69 try:
70 bzr_main(os.path.basename(sys.argv[0]), sys.argv[1:])
71 except FatalException, e:
72 sys.stderr.write(str(e) + '\n')
73 sys.exit(1)