~0x44/nova/bug838466

515.6.3 by Soren Hansen
Add copyright and license info to version.py
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3
#    Copyright 2011 OpenStack LLC
4
#
5
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
6
#    not use this file except in compliance with the License. You may obtain
7
#    a copy of the License at
8
#
9
#         http://www.apache.org/licenses/LICENSE-2.0
10
#
11
#    Unless required by applicable law or agreed to in writing, software
12
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
#    License for the specific language governing permissions and limitations
15
#    under the License.
16
515.6.2 by Soren Hansen
Less code generation.
17
try:
18
    from nova.vcsversion import version_info
19
except ImportError:
20
    version_info = {'branch_nick': u'LOCALBRANCH',
21
                    'revision_id': 'LOCALREVISION',
22
                    'revno': 0}
23
24
NOVA_VERSION = ['2011', '1']
25
YEAR, COUNT = NOVA_VERSION
26
27
FINAL = False   # This becomes true at Release Candidate time
28
29
30
def canonical_version_string():
515.5.3 by Todd Willey
Add default version file for developers.
31
    return '.'.join([YEAR, COUNT])
32
33
515.6.2 by Soren Hansen
Less code generation.
34
def version_string():
35
    if FINAL:
36
        return canonical_version_string()
37
    else:
38
        return '%s-dev' % (canonical_version_string(),)
39
40
515.5.3 by Todd Willey
Add default version file for developers.
41
def vcs_version_string():
42
    return "%s:%s" % (version_info['branch_nick'], version_info['revision_id'])
43
44
515.6.2 by Soren Hansen
Less code generation.
45
def version_string_with_vcs():
46
    return "%s-%s" % (canonical_version_string(), vcs_version_string())