/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 bzrlib/__init__.py

  • Committer: Robert Collins
  • Date: 2009-03-10 01:16:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4104.
  • Revision ID: robertc@robertcollins.net-20090310011651-73eyp8l970t21ah8
Allow self documenting hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
 
60
60
def _format_version_tuple(version_info):
61
 
    """Turn a version number 3-tuple or 5-tuple into a short string.
 
61
    """Turn a version number 2, 3 or 5-tuple into a short string.
62
62
 
63
63
    This format matches <http://docs.python.org/dist/meta-data.html>
64
64
    and the typical presentation used in Python output.
74
74
    1.1.1rc2
75
75
    >>> print _format_version_tuple((1, 4, 0))
76
76
    1.4
 
77
    >>> print _format_version_tuple((1, 4))
 
78
    1.4
77
79
    >>> print _format_version_tuple((1, 4, 0, 'wibble', 0))
78
80
    Traceback (most recent call last):
79
81
    ...
80
82
    ValueError: version_info (1, 4, 0, 'wibble', 0) not valid
81
83
    """
82
 
    if version_info[2] == 0:
 
84
    if len(version_info) == 2 or version_info[2] == 0:
83
85
        main_version = '%d.%d' % version_info[:2]
84
86
    else:
85
87
        main_version = '%d.%d.%d' % version_info[:3]