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/>.
21 """Store version info for this BE installation.
23 By default, use the Git-generated information in
24 :py:mod:`~libbe._version`, but allow manual overriding by setting
25 :py:data:`libbe.version._VERSION`. This allows support of both the "I
26 don't want to be bothered setting version strings" and the "I want
27 complete control over the version strings" workflows.
34 from ._version import version_info
35 except ImportError as e:
37 logging.warn('unable to import libbe._version: {0}'.format(e))
39 'revision': 'unknown',
41 'committer': 'unknown',
44 # Manually set a version string (optional, defaults to bzr revision id)
47 def version(verbose=False):
49 Returns the version string for this BE installation. If
50 verbose==True, the string will include extra lines with more
51 detail (e.g. last committer's name, etc.).
53 if "_VERSION" in globals():
56 string = version_info['revision'][:8]
58 info = copy.copy(version_info)
59 info['storage'] = libbe.storage.STORAGE_VERSION
62 'revision: {revision}\n'
64 'committer: {committer}\n'
65 'storage version: {storage}'
70 if __name__ == '__main__':
71 print(version(verbose=True))