|
4 | 4 | """
|
5 | 5 |
|
6 | 6 | 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 |
7 | 11 |
|
8 | 12 | LICENSE = open('LICENSE').read()
|
9 | 13 | 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 | 16 | OWNER_NAMES = 'emilmont, bogdanm'
|
13 | 17 |
|
14 | 18 |
|
| 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 | + |
15 | 32 | setup(name='mbed-tools',
|
16 |
| - version='0.1.7', |
| 33 | + version='0.1.14', |
17 | 34 | description='Build and test system for mbed',
|
18 | 35 | long_description=DESCRIPTION,
|
19 | 36 | author=OWNER_NAMES,
|
20 | 37 | author_email=OWNER_EMAILS,
|
21 | 38 | maintainer=OWNER_NAMES,
|
22 | 39 | maintainer_email=OWNER_EMAILS,
|
23 | 40 | url='https://github.com/mbedmicro/mbed',
|
| 41 | + packages=find_packages(), |
24 | 42 | 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) |
0 commit comments