Skip to content

Commit e582e5c

Browse files
committed
ci: Use setuptools_scm to get version
Use setuptools_scm to unify version information in following packages: * mbed-os-tools * mbed-ls * mbed-host-tests * mbed-greentea The `src/mbed_os_tools/VERSION.txt` is removed.
1 parent 01aa72a commit e582e5c

File tree

9 files changed

+20
-13
lines changed

9 files changed

+20
-13
lines changed

packages/mbed-greentea/setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def read(fname):
5353

5454
python_requires = '>=2.7.10, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4'
5555
setup(name='mbed-greentea',
56-
version='1.7.4',
5756
description=DESCRIPTION,
5857
long_description=read('README.md'),
5958
long_description_content_type='text/markdown',
@@ -83,6 +82,10 @@ def read(fname):
8382
'Topic :: Software Development :: Embedded Systems',
8483
'Topic :: Software Development :: Testing',
8584
),
85+
use_scm_version = {
86+
"root": "../..",
87+
"relative_to": __file__
88+
},
8689
python_requires=python_requires,
8790
install_requires=requirements,
8891
tests_require=test_requirements

packages/mbed-greentea/test/mbed_gt_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def test_get_greentea_version(self):
6363
version = mbed_greentea_cli.get_greentea_version()
6464

6565
self.assertIs(type(version), str)
66+
extra_info_pos = version.find('dev')
67+
version = version[:extra_info_pos-1]
6668

6769
a, b, c = version.split('.')
6870

packages/mbed-host-tests/setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def read(fname):
5353

5454
python_requires = '>=2.7.10, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4'
5555
setup(name='mbed-host-tests',
56-
version='1.5.10',
5756
description=DESCRIPTION,
5857
long_description=read('README.md'),
5958
long_description_content_type='text/markdown',
@@ -85,6 +84,10 @@ def read(fname):
8584
'Topic :: Software Development :: Embedded Systems',
8685
'Topic :: Software Development :: Testing',
8786
),
87+
use_scm_version = {
88+
"root": "../..",
89+
"relative_to": __file__
90+
},
8891
python_requires=python_requires,
8992
install_requires=requirements,
9093
tests_require=test_requirements

packages/mbed-ls/setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def read(fname):
5050

5151
python_requires = '>=2.7.10, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4'
5252
setup(name='mbed-ls',
53-
version='1.7.12',
5453
description=DESCRIPTION,
5554
long_description=read('README.md'),
5655
long_description_content_type='text/markdown',
@@ -76,6 +75,10 @@ def read(fname):
7675
'Topic :: Software Development :: Build Tools',
7776
'Topic :: Software Development :: Embedded Systems',
7877
),
78+
use_scm_version = {
79+
"root": "../..",
80+
"relative_to": __file__
81+
},
7982
python_requires=python_requires,
8083
entry_points={
8184
"console_scripts": [

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def read(fname):
5252
python_requires = '>=2.7.10, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4'
5353
setup(
5454
name="mbed-os-tools",
55-
version=read("src/mbed_os_tools/VERSION.txt").strip(),
5655
description=DESCRIPTION,
5756
long_description=read("README.md"),
5857
long_description_content_type='text/markdown',
@@ -63,7 +62,6 @@ def read(fname):
6362
url="https://github.com/ARMmbed/mbed-os-tools",
6463
packages=find_packages("src"),
6564
package_dir={"": "src"},
66-
package_data={"": ["VERSION.txt"]},
6765
license="Apache-2.0",
6866
test_suite="test",
6967
classifiers=(
@@ -81,6 +79,7 @@ def read(fname):
8179
'Topic :: Software Development :: Build Tools',
8280
'Topic :: Software Development :: Embedded Systems',
8381
),
82+
use_scm_version=True,
8483
python_requires=python_requires,
8584
install_requires=requirements,
8685
tests_require=test_requirements,

src/mbed_os_tools/VERSION.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/mbed_os_tools/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,3 @@
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-
import os
17-
18-
_version_file_path = os.path.join(os.path.dirname(__file__), "VERSION.txt")
19-
with open(_version_file_path, 'r') as _version_file:
20-
__version__ = _version_file.read().strip()

src/mbed_os_tools/test/host_tests_runner/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@
1919
Functionality can be overridden by set of plugins which can provide specialised flashing and reset implementations.
2020
2121
"""
22+
23+
from setuptools_scm import get_version
24+
25+
__version__ = get_version(root='../../../..', relative_to=__file__)

src/mbed_os_tools/test/host_tests_runner/host_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from sys import stdout
1717
from .mbed_base import Mbed
18-
from ... import __version__
18+
from . import __version__
1919

2020

2121
class HostTestResults(object):

0 commit comments

Comments
 (0)