Skip to content

Commit b74e0c8

Browse files
author
Bogdan Marinescu
committed
mbed-tools package improvements
- install all the needed components - use a customized version of private_settings.py. Projects using mbed-tools will be able to use mbed_settings.py instead of private_settings.py. This ensures compatibility with the current structure.
1 parent 8ec31ea commit b74e0c8

File tree

4 files changed

+28
-99
lines changed

4 files changed

+28
-99
lines changed

MANIFEST

Lines changed: 0 additions & 96 deletions
This file was deleted.

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
graft workspace_tools
2-
include __init__.py LICENSE
2+
recursive-exclude workspace_tools *.pyc
3+
include LICENSE

setup.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"""
55

66
from distutils.core import setup
7+
from setuptools import find_packages
8+
from os.path import isfile, join
9+
from tempfile import TemporaryFile
10+
from shutil import copyfileobj
711

812
LICENSE = open('LICENSE').read()
913
DESCRIPTION = """A set of Python scripts that can be used to compile programs written on top of the `mbed framework`_. It can also be used to export mbed projects to other build systems and IDEs (uVision, IAR, makefiles).
@@ -12,13 +16,33 @@
1216
OWNER_NAMES = 'emilmont, bogdanm'
1317
1418

19+
# If private_settings.py exists in workspace_tools, read it in a temporary file
20+
# so it can be restored later
21+
private_settings = join('workspace_tools', 'private_settings.py')
22+
backup = None
23+
if isfile(private_settings):
24+
backup = TemporaryFile()
25+
with open(private_settings, "rb") as f:
26+
copyfileobj(f, backup)
27+
28+
# Create the correct private_settings.py for the distribution
29+
with open(private_settings, "wt") as f:
30+
f.write("from mbed_settings import *\n")
31+
1532
setup(name='mbed-tools',
16-
version='0.1.7',
33+
version='0.1.14',
1734
description='Build and test system for mbed',
1835
long_description=DESCRIPTION,
1936
author=OWNER_NAMES,
2037
author_email=OWNER_EMAILS,
2138
maintainer=OWNER_NAMES,
2239
maintainer_email=OWNER_EMAILS,
2340
url='https://github.com/mbedmicro/mbed',
41+
packages=find_packages(),
2442
license=LICENSE)
43+
44+
# Restore previous private_settings if needed
45+
if backup:
46+
backup.seek(0)
47+
with open(private_settings, "wb") as f:
48+
copyfileobj(backup, f)

workspace_tools/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@
106106
# settings file stored in the repository
107107
from workspace_tools.private_settings import *
108108
except ImportError:
109-
print '[WARNING] Using default settings. Define you settings in the file "workspace_tools/private_settings.py"'
109+
print '[WARNING] Using default settings. Define you settings in the file "workspace_tools/private_settings.py" or in "./mbed_settings.py"'

0 commit comments

Comments
 (0)