diff options
author | Gökçen Nurlu <gnurlu1@bloomberg.net> | 2018-01-11 18:06:45 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-01-31 15:48:15 +0100 |
commit | 8890142147a6f3a460a0f7a0690996a9c6b48137 (patch) | |
tree | dac7d0f6c4673c02d132132f4e530162841ffab5 /buildstream/_frontend/widget.py | |
parent | 4304611452a9ba8f461e302d2852c54023356826 (diff) | |
download | buildstream-8890142147a6f3a460a0f7a0690996a9c6b48137.tar.gz |
Get version number w/o pkg_resources
This removes most of the usages of pkg_resources from the codebase, helping
the goal of getting rid of that completely.
With this change, version number is generated during install and embedded into
`__version__` which is then imported by root level `__init__`. From there,
it is used by other parts of the codebase when needed.
Generated `__version__` file is ignored and not tracked by git to prevent
unnecessary 'changes' messages and accidental commits of that file.
Diffstat (limited to 'buildstream/_frontend/widget.py')
-rw-r--r-- | buildstream/_frontend/widget.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py index 1dccd0059..d61f338df 100644 --- a/buildstream/_frontend/widget.py +++ b/buildstream/_frontend/widget.py @@ -24,12 +24,12 @@ from contextlib import ExitStack from mmap import mmap import click -import pkg_resources from ruamel import yaml from . import Profile from .. import Element, Scope, Consistency from .. import _yaml +from .. import __version__ as bst_version from .._exceptions import ImplError from .._message import MessageType from ..plugin import _plugin_lookup @@ -432,12 +432,11 @@ class LogLine(Widget): context = pipeline.context project = pipeline.project starttime = datetime.datetime.now() - bst = pkg_resources.require("buildstream")[0] text = '' # Main invocation context text += '\n' - text += self.content_profile.fmt("BuildStream Version {}\n".format(bst.version), bold=True) + text += self.content_profile.fmt("BuildStream Version {}\n".format(bst_version), bold=True) values = OrderedDict() values["Session Start"] = starttime.strftime('%A, %d-%m-%Y at %H:%M:%S') values["Project"] = "{} ({})".format(project.name, project.directory) |