Skip to content

Commit e4ffc61

Browse files
Merge pull request #42 from bridadan/version_into_module
Version into module
2 parents fdedaa6 + ae4e4b7 commit e4ffc61

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

mbed_os_tools/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
16+
__version__ = "0.0.1"

mbed_os_tools/test/host_tests_plugins/module_reset_pyocd.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ class HostTestPluginResetMethod_pyOCD(HostTestPluginBase):
2626

2727
def __init__(self):
2828
"""! ctor
29-
@details We can check module version by referring to version attribute
30-
import pkg_resources
31-
print pkg_resources.require("mbed-host-tests")[0].version
32-
'2.7'
3329
"""
3430
HostTestPluginBase.__init__(self)
3531

mbed_os_tools/test/host_tests_runner/host_test.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
import pkg_resources
1716
from sys import stdout
1817
from .mbed_base import Mbed
18+
from ... import __version__
1919

2020

2121
class HostTestResults(object):
@@ -123,9 +123,7 @@ def finish(self):
123123
def get_hello_string(self):
124124
""" Hello string used as first print
125125
"""
126-
pkg = 'mbed-host-tests'
127-
version = pkg_resources.require(pkg)[0].version
128-
return "host test executor ver. " + version
126+
return "host test executor ver. " + __version__
129127

130128

131129
class DefaultTestSelectorBase(Test):

mbed_os_tools/test/host_tests_runner/host_test_default.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from ..host_tests_logger import HtrunLogger
3838
from ..host_tests_conn_proxy import conn_process
3939
from ..host_tests_toolbox.host_functional import handle_send_break_cmd
40+
from ... import __version__
4041
if (sys.version_info > (3, 0)):
4142
from queue import Empty as QueueEmpty
4243
else:
@@ -82,9 +83,7 @@ def __init__(self, options):
8283
sys.exit(0)
8384

8485
if options.version: # --version
85-
import pkg_resources # part of setuptools
86-
version = pkg_resources.require("mbed-host-tests")[0].version
87-
print(version)
86+
print(__version__)
8887
sys.exit(0)
8988

9089
if options.send_break_cmd: # -b with -p PORT (and optional -r RESET_TYPE)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from distutils.core import setup
1818
from io import open
1919
from setuptools import find_packages
20+
import mbed_os_tools
2021

2122
DESCRIPTION = "The tools to build, test, and work with Mbed OS"
2223
OWNER_NAMES = "Jimmy Brisson, Brian Daniels"
@@ -30,7 +31,7 @@ def read(fname):
3031

3132
setup(
3233
name="mbed-os-tools",
33-
version="0.0.1",
34+
version=mbed_os_tools.__version__,
3435
description=DESCRIPTION,
3536
long_description=read("README.md"),
3637
author=OWNER_NAMES,

0 commit comments

Comments
 (0)