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