/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: Martin Pool
  • Date: 2008-03-16 08:51:24 UTC
  • mfrom: (3185.1.13 setup_py)
  • mto: (3287.7.1 1.3)
  • mto: This revision was merged to the branch mainline in revision 3286.
  • Revision ID: mbp@sourcefrog.net-20080316085124-8y2yido4at4cz954
merge setup.py fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
# API compatibility version: bzrlib is currently API compatible with 0.18.
47
47
api_minimum_version = (0, 18, 0)
48
48
 
49
 
if version_info[3] == 'final':
50
 
    version_string = '%d.%d.%d' % version_info[:3]
51
 
else:
 
49
def _format_version_tuple(version_info):
 
50
    """Turn a version number 5-tuple into a short string.
 
51
 
 
52
    This format matches <http://docs.python.org/dist/meta-data.html>
 
53
    and the typical presentation used in Python output.
 
54
 
 
55
    This also checks that the version is reasonable: the sub-release must be
 
56
    zero for final releases, and non-zero for alpha, beta and preview.
 
57
 
 
58
    >>> print _format_version_tuple((1, 0, 0, 'final', 0))
 
59
    1.0
 
60
    >>> print _format_version_tuple((1, 2, 0, 'dev', 0))
 
61
    1.2dev
 
62
    >>> print _format_version_tuple((1, 1, 1, 'candidate', 2))
 
63
    1.1.1rc2
 
64
    """
 
65
    if version_info[2] == 0:
 
66
        main_version = '%d.%d' % version_info[:2]
 
67
    else:
 
68
        main_version = '%d.%d.%d' % version_info[:3]
 
69
 
 
70
    __release_type = version_info[3]
 
71
    __sub = version_info[4]
 
72
 
 
73
    # check they're consistent
 
74
    if __release_type == 'final' and __sub == 0:
 
75
        __sub_string = ''
 
76
    elif __release_type == 'dev' and __sub == 0:
 
77
        __sub_string = 'dev'
 
78
    elif __release_type in ('alpha', 'beta') and __sub != 0:
 
79
        __sub_string = __release_type[0] + str(__sub)
 
80
    elif __release_type == 'candidate' and __sub != 0:
 
81
        __sub_string = 'rc' + str(__sub)
 
82
    else:
 
83
        raise AssertionError("version_info %r not valid" % version_info)
 
84
 
52
85
    version_string = '%d.%d.%d.%s.%d' % version_info
53
 
__version__ = version_string
 
86
    return main_version + __sub_string
 
87
 
 
88
__version__ = _format_version_tuple(version_info)
 
89
version_string = __version__
 
90
 
54
91
 
55
92
# allow bzrlib plugins to be imported.
56
93
import bzrlib.plugin