2 # Copyright (C) 2009-2012 Chris Ball <cjb@laptop.org>
3 # Gianluca Montecchi <gian@grys.it>
4 # W. Trevor King <wking@tremily.us>
6 # This file is part of Bugs Everywhere.
8 # Bugs Everywhere is free software: you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by the Free
10 # Software Foundation, either version 2 of the License, or (at your option) any
13 # Bugs Everywhere is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 # You should have received a copy of the GNU General Public License along with
19 # Bugs Everywhere. If not, see <http://www.gnu.org/licenses/>.
22 Store version info for this BE installation. By default, use the
23 bzr-generated information in _version.py, but allow manual overriding
24 by setting _VERSION. This allows support of both the "I don't want to
25 be bothered setting version strings" and the "I want complete control
26 over the version strings" workflows.
33 from ._version import version_info
34 except ImportError, e:
36 logging.warn('unable to import libbe._version: %s' % e)
38 'revision': 'unknown',
40 'committer': 'unknown',
43 # Manually set a version string (optional, defaults to bzr revision id)
46 def version(verbose=False):
48 Returns the version string for this BE installation. If
49 verbose==True, the string will include extra lines with more
50 detail (e.g. last committer's name, etc.).
52 if "_VERSION" in globals():
55 string = version_info['revision']
57 info = copy.copy(version_info)
58 info['storage'] = libbe.storage.STORAGE_VERSION
60 "revision: %(revision)s\n"
62 "committer: %(committer)s\n"
63 "storage version: %(storage)s"
67 if __name__ == "__main__":
68 print version(verbose=True)