Skip to content

Commit 2d00681

Browse files
committed
Fixing single source version
1 parent 47b2539 commit 2d00681

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
import os
1717
from distutils.core import setup
18-
from io import open
1918
from setuptools import find_packages
20-
#import mbed_os_tools
2119

2220
DESCRIPTION = "The tools to build, test, and work with Mbed OS"
2321
OWNER_NAMES = "Jimmy Brisson, Brian Daniels"
@@ -26,12 +24,13 @@
2624

2725
# Utility function to cat in a file (used for the README)
2826
def read(fname):
29-
return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf8").read()
27+
with open(os.path.join(os.path.dirname(__file__), fname), 'r') as f:
28+
return f.read()
3029

3130

3231
setup(
3332
name="mbed-os-tools",
34-
version='0.0.1',
33+
version=read("src/mbed_os_tools/VERSION.txt"),
3534
description=DESCRIPTION,
3635
long_description=read("README.md"),
3736
author=OWNER_NAMES,
@@ -41,6 +40,7 @@ def read(fname):
4140
url="https://github.com/ARMmbed/mbed-os-tools",
4241
packages=find_packages("src"),
4342
package_dir={"": "src"},
43+
package_data={"": ["VERSION.txt"]},
4444
license="Apache-2.0",
4545
test_suite="test",
4646
install_requires=[

src/mbed_os_tools/VERSION.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

src/mbed_os_tools/__init__.py

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

16-
__version__ = "0.0.1"
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()

0 commit comments

Comments
 (0)