aboutsummaryrefslogtreecommitdiff
path: root/bart
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-07-07 18:15:10 +0100
committerJavi Merino <javi.merino@arm.com>2016-07-07 18:15:10 +0100
commitadb8fc25ebaa2a3a46719ad5670613e75f67fa31 (patch)
tree15f89a0d209845d4697c8c41dd328259ea955547 /bart
parentf9054d7f36c9c892f85aad1f0ff79aa3e2f6ce55 (diff)
downloadbart-adb8fc25ebaa2a3a46719ad5670613e75f67fa31.tar.gz
bart: set the version using an explicit file
There is no pythonic way of specifying the version of a project, [0] describes 7 (seven!) ways of doing it. We were currently using method 5, setting the value in setup.py and using pkg_resources to get it from the installed version. This works ok if you have installed the package using python setup.py or pip, but fails if you are importing bart from a checkout, which is what lisa do. Even worse, if you import it from lisa but have an old bart version installed, bart.__version__ will tell you the version of the installed bart, not the one you have imported and are using. Switch to use a version.py file that's distributed with the project (method 3), as trappy did in ARM-software/trappy@712e6f93b308 . Fixes #57 [0] https://packaging.python.org/en/latest/single_source_version/
Diffstat (limited to 'bart')
-rw-r--r--bart/__init__.py7
-rw-r--r--bart/version.py16
2 files changed, 17 insertions, 6 deletions
diff --git a/bart/__init__.py b/bart/__init__.py
index c031ebb..886dbc8 100644
--- a/bart/__init__.py
+++ b/bart/__init__.py
@@ -18,9 +18,4 @@
import bart.sched
import bart.common
import bart.thermal
-import pkg_resources
-
-try:
- __version__ = pkg_resources.get_distribution("bart-py").version
-except pkg_resources.DistributionNotFound:
- __version__ = "local"
+from bart.version import __version__
diff --git a/bart/version.py b/bart/version.py
new file mode 100644
index 0000000..da8af07
--- /dev/null
+++ b/bart/version.py
@@ -0,0 +1,16 @@
+# Copyright 2016-2016 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+__version__ = "1.5.0"