Handle --trunk via optparse.
[cvs2svn.git] / cvs2svn
blobc4c20a0215936db3266adca89f33ed3941b0d3a5
1 #!/usr/bin/env python
2 # (Be in -*- python -*- mode.)
4 # ====================================================================
5 # Copyright (c) 2000-2007 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: cvs2svn 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 cvs2svn 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 cvs2svn 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 from cvs2svn_lib.common import FatalException
64 from cvs2svn_lib.main import main
67 try:
68 main(sys.argv[0], sys.argv[1:])
69 except FatalException, e:
70 sys.stderr.write(str(e) + '\n')
71 sys.exit(1)