~zulcss/ubuntu/precise/quantum/trunk

« back to all changes in this revision

Viewing changes to quantum/plugins/bigswitch/version.py

  • Committer: Chuck Short
  • Date: 2012-11-26 19:51:11 UTC
  • mfrom: (26.1.1 raring-proposed)
  • Revision ID: zulcss@ubuntu.com-20121126195111-jnz2cr4xi6whemw2
* New upstream release for the Ubuntu Cloud Archive.
* debian/patches/*: Refreshed for opening of Grizzly.
* New upstream release.
* debian/rules: FTFBS if there is missing binaries.
* debian/quantum-server.install: Add quantum-debug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
#
 
3
# Copyright 2012 OpenStack, LLC
 
4
# Copyright 2012, Big Switch Networks, Inc.
 
5
#
 
6
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
7
#    not use this file except in compliance with the License. You may obtain
 
8
#    a copy of the License at
 
9
#
 
10
#         http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
12
#    Unless required by applicable law or agreed to in writing, software
 
13
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
14
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
15
#    License for the specific language governing permissions and limitations
 
16
#    under the License.
 
17
#
 
18
# Based on openstack generic code
 
19
# @author: Mandeep Dhami, Big Switch Networks, Inc.
 
20
 
 
21
"""Determine version of QuantumRestProxy plugin"""
 
22
 
 
23
# if vcsversion exists, use it. Else, use LOCALBRANCH:LOCALREVISION
 
24
try:
 
25
    from bigswitch.vcsversion import version_info
 
26
except ImportError:
 
27
    version_info = {'branch_nick': u'LOCALBRANCH',
 
28
                    'revision_id': u'LOCALREVISION',
 
29
                    'revno': 0}
 
30
 
 
31
 
 
32
QUANTUMRESTPROXY_VERSION = ['2012', '1', None]
 
33
YEAR, COUNT, REVISION = QUANTUMRESTPROXY_VERSION
 
34
FINAL = False   # This becomes true at Release Candidate time
 
35
 
 
36
 
 
37
def canonical_version_string():
 
38
    return '.'.join(filter(None, QUANTUMRESTPROXY_VERSION))
 
39
 
 
40
 
 
41
def version_string():
 
42
    if FINAL:
 
43
        return canonical_version_string()
 
44
    else:
 
45
        return '%s-dev' % (canonical_version_string(),)
 
46
 
 
47
 
 
48
def vcs_version_string():
 
49
    return "%s:%s" % (version_info['branch_nick'], version_info['revision_id'])
 
50
 
 
51
 
 
52
def version_string_with_vcs():
 
53
    return "%s-%s" % (canonical_version_string(), vcs_version_string())
 
54
 
 
55
 
 
56
if __name__ == "__main__":
 
57
    print version_string_with_vcs()