Skip to content

Commit ae4e4b7

Browse files
committed
Change code to not use pkg_resources for version number
1 parent 60f8ee0 commit ae4e4b7

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

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)

0 commit comments

Comments
 (0)