~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/__init__.py

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
IGNORE_FILENAME = ".bzrignore"
44
44
 
45
45
 
46
 
__copyright__ = "Copyright 2005-2011 Canonical Ltd."
 
46
__copyright__ = "Copyright 2005-2010 Canonical Ltd."
47
47
 
48
48
# same format as sys.version_info: "A tuple containing the five components of
49
49
# the version number: major, minor, micro, releaselevel, and serial. All
52
52
# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
53
53
# releaselevel of 'dev' for unreleased under-development code.
54
54
 
55
 
version_info = (2, 4, 0, 'dev', 6)
 
55
version_info = (2, 4, 0, 'dev', 3)
56
56
 
57
57
# API compatibility version
58
58
api_minimum_version = (2, 4, 0)
81
81
    1.4.0
82
82
    >>> print _format_version_tuple((1, 4))
83
83
    1.4
84
 
    >>> print _format_version_tuple((2, 1, 0, 'final', 42))
85
 
    2.1.0.42
 
84
    >>> print _format_version_tuple((2, 1, 0, 'final', 1))
 
85
    Traceback (most recent call last):
 
86
    ...
 
87
    ValueError: version_info (2, 1, 0, 'final', 1) not valid
86
88
    >>> print _format_version_tuple((1, 4, 0, 'wibble', 0))
87
 
    1.4.0.wibble.0
 
89
    Traceback (most recent call last):
 
90
    ...
 
91
    ValueError: version_info (1, 4, 0, 'wibble', 0) not valid
88
92
    """
89
93
    if len(version_info) == 2:
90
94
        main_version = '%d.%d' % version_info[:2]
96
100
    release_type = version_info[3]
97
101
    sub = version_info[4]
98
102
 
 
103
    # check they're consistent
99
104
    if release_type == 'final' and sub == 0:
100
105
        sub_string = ''
101
 
    elif release_type == 'final':
102
 
        sub_string = '.' + str(sub)
103
106
    elif release_type == 'dev' and sub == 0:
104
107
        sub_string = 'dev'
105
108
    elif release_type == 'dev':
111
114
    elif release_type == 'candidate':
112
115
        sub_string = 'rc' + str(sub)
113
116
    else:
114
 
        return '.'.join(map(str, version_info))
 
117
        raise ValueError("version_info %r not valid" % (version_info,))
115
118
 
116
119
    return main_version + sub_string
117
120