~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: Martin Pool
  • Date: 2008-04-30 08:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 3396.
  • Revision ID: mbp@sourcefrog.net-20080430080411-imrex2wtwpb9eivj
_format_version_tuple can take a 3-tuple

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
api_minimum_version = (0, 18, 0)
48
48
 
49
49
def _format_version_tuple(version_info):
50
 
    """Turn a version number 5-tuple into a short string.
 
50
    """Turn a version number 3-tuple or 5-tuple into a short string.
51
51
 
52
52
    This format matches <http://docs.python.org/dist/meta-data.html>
53
53
    and the typical presentation used in Python output.
61
61
    1.2dev
62
62
    >>> print _format_version_tuple((1, 1, 1, 'candidate', 2))
63
63
    1.1.1rc2
 
64
    >>> print _format_version_tuple((1, 4, 0))
 
65
    1.4
64
66
    """
65
67
    if version_info[2] == 0:
66
68
        main_version = '%d.%d' % version_info[:2]
67
69
    else:
68
70
        main_version = '%d.%d.%d' % version_info[:3]
 
71
    if len(version_info) <= 3:
 
72
        return main_version
69
73
 
70
74
    __release_type = version_info[3]
71
75
    __sub = version_info[4]