aboutsummaryrefslogtreecommitdiff
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
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/
-rw-r--r--bart/__init__.py7
-rw-r--r--bart/version.py16
-rw-r--r--docs/api_reference/conf.py6
-rw-r--r--setup.py4
4 files changed, 22 insertions, 11 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"
diff --git a/docs/api_reference/conf.py b/docs/api_reference/conf.py
index 0d54455..32d6653 100644
--- a/docs/api_reference/conf.py
+++ b/docs/api_reference/conf.py
@@ -81,10 +81,10 @@ author = u'Kapileshwar Singh(KP), Javi Merino'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-# The short X.Y version.
-version = '1.5'
+# The short X.Y version. Drop everything after the last "."
+version = bart.__version__[:bart.__version__.rindex(".")]
# The full version, including alpha/beta/rc tags.
-release = '1.5.0'
+release = bart.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/setup.py b/setup.py
index 69c3876..c73c225 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@
from setuptools import setup, find_packages
-VERSION = "1.5.0"
+execfile("bart/version.py")
LONG_DESCRIPTION = """Behavioural Analysis involves the expressing the general
expectation of the state of the system while targeting a single or set of heuristics.
@@ -34,7 +34,7 @@ REQUIRES = [
]
setup(name='bart-py',
- version=VERSION,
+ version=__version__,
license="Apache v2",
author="ARM-BART",
author_email="bart@arm.com",